Skip to content

Docs: example of using returned Access Tokens in middleware? #187

@bessey

Description

@bessey

(Hello, me again 😅)

I'm getting a bit stuck rolling out an OAuth2 implementation built upon this library. On the OAuth2 flows side of things, all is well mostly thanks to cribbing bits I didn't understand from the docs from the example/ directory.

However, not present in the example is the recommended way to use the generated Access Tokens to actually authorise requests to other private endpoints.

Without this, I have these assumptions / questions:

  • I guess I should be using JwtService to verify the JWT and decode its contents? But that's stateless so the token could have been revoked...
  • So I guess I should also be calling OAuthTokenRepository.getByAccessToken to confirm the token is not revoked?
  • I was kind of expecting the library to expose a convenient API to do a lot of this for me, e.g. authorizationServer.verifyToken(accessToken: string): Promise<OAuthToken>, but it seems this is up to the User?. I've provided AuthorizationServer all these repositories and a custom JWT service, why do I have to string them back together on the middleware side of things?

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions