• Home
  • Categories
  • Recent
  • Popular
  • Pricing
  • Contact us
  • Docs
  • Login
FusionAuth
  • Home
  • Categories
  • Recent
  • Popular
  • Pricing
  • Contact us
  • Docs
  • Login

Can we add more information to the access token response we get during the OAuth flow?

Scheduled Pinned Locked Moved Solved
Q&A
login oauth access tokens
1
2
4.8k
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D
    dan
    last edited by 27 May 2020, 16:55

    We use a standard authorization code grant. We call into /oauth2/token and get back something like this:

    {
    "access_token":"...",
    "expires_in":86399,
    "refresh_token":"...",
    "token_type":"Bearer",
    "userId":"..."
    }
    

    We'd like to add some more properties to this JSON response. Is that possible?

    --
    FusionAuth - Auth so modern you can download it.
    https://fusionauth.io

    1 Reply Last reply Reply Quote 0
    • D
      dan
      last edited by 27 May 2020, 16:56

      That response is essentially defined by OAuth2 / OIDC as the token response. If you want to customize it, the best solution is to use a lambda to encode additional details in the access_token (JWT) and then at the client decode that value to extract the necessary claims.

      More on lambdas: https://fusionauth.io/docs/v1/tech/lambdas/jwt-populate

      --
      FusionAuth - Auth so modern you can download it.
      https://fusionauth.io

      1 Reply Last reply Reply Quote 0
      2 out of 2
      • First post
        2/2
        Last post