Skip to content
This repository was archived by the owner on Dec 13, 2018. It is now read-only.
This repository was archived by the owner on Dec 13, 2018. It is now read-only.

Allow users to get an AccessToken before making Http calls #43

@mraible

Description

@mraible

From the AngularJS implementation:

// This access token getter attempts to refresh expired access tokens if needed, which is why it is async (promise)

$auth.getAccessToken()
  .then(function(accessToken){
    $http({
      url: 'http://localhost:3000/api/subscription',
      method: 'GET',
      headers: {
        Authorization: 'Bearer ' + accessToken
      }
    );
  })
  .catch(function(){
    // Could not get access token, user is not logged in
  });

If access token is expired, it will automatically try to get a new one with a refresh token.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions