Skip to content

Integrating JWT and Refresh Token Authentication #94

Answered by agordn52
darezzed asked this question in Q&A
Discussion options

You must be logged in to vote

@darezzed,

In the latest version, I've added three new methods that you can override to make life easier for auth tokens.

The first is for setting authentication headers.

/* Authentication Headers
|--------------------------------------------------------------------------
| Set your auth headers
| Authenticate your API requests using a bearer token or any other method
|--------------------------------------------------------------------------
*/

Future<RequestHeaders> setAuthHeaders(RequestHeaders headers) async {
    String? myAuthToken = await StorageKey.userToken.read();
    if (myAuthToken != null) {
      headers.addBearerToken( myAuthToken );
    }
    return headers;
}

The second …

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@darezzed
Comment options

@agordn52
Comment options

Answer selected by agordn52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants