Skip to content

bug: logto/client getAccessToken with a resource does not include the scopes in the token #1009

@maddijoyce

Description

@maddijoyce

Describe the bug

Using logto/node, I'm authenticating my user then attempting to get a JWT access token, so I call

const token = await client.getAccessToken(resourceUrl);

The token is successfully generated and returned, however it does not have any scopes.

Expected behavior

I believe the token should have the scopes from the options when the client is initialised, but looking at the source -

const { accessToken, refreshToken, idToken, scope, expiresIn } = await fetchTokenByRefreshToken(
- it does not include scopes in this call.

I'm happy to add a PR for this, just wanted to check this was in fact a bug.

How to reproduce?

  • Create a new Client from @logto/node
  • Authenticate the client
  • Call getAccessToken with a resource.

Environment

Self-hosted (Docker image)

Screenshots

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions