How to get the data from a Oauth2 rew

Tagged: 

This topic has 3 replies, 2 voices, and was last updated 3 months, 1 week ago by Jatinder Singh.

  • Author
    Posts
  • #28051
     CSTG_Xiaohan
    Participant

    In a Oauth2 client credential flow, I use a curl command and get a token from the server. My command like this:

    curl –request POST –data “grant_type=client_credentials&client_id=le-test-client&client_secret=password&scope=read” “http://openam.example.com:8080/openam/oauth2/realms/le-test/access_token”

    Then I add a parameter like this:

    curl –request POST –data “grant_type=client_credentials&client_id=le-test-client&client_secret=password&scope=profile&uid=user.1” “http://openam.example.com:8080/openam/oauth2/realms/le-test/access_token”

    And now I want to add the uid inside the JWT token, I stuck on how to extract the data from my request in the OAuth2 Access Token Modification Script. In the defined variables of this script I don’t find request, and have no idea how to create a variable that refer to my request.

    #28056
     Jatinder Singh
    Participant

    Howdy!

    You can define a custom scope validator that extends from OpenAMScopeValidator and add additional claims to your Access Token in the additionalDataToReturnFromTokenEndpoint method.

    Hope this helps!

    #28072
     CSTG_Xiaohan
    Participant

    Yes, I think it’s a good way to solve my problem, thanks for your help

    Best & Thanks
    Xiaohan

    #28074
     Jatinder Singh
    Participant

    Np :) Glad it helped!

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

©2020 ForgeRock - we provide an identity and access platform to secure every online relationship for the enterprise market, educational sector and even entire countries. Click to view our privacy policy and terms of use.

Log in with your credentials

Forgot your details?