Forum Discussion

brandon03's avatar
brandon03
New Contributor
2 years ago

Adding user_id to OAuth 2.0 Authorization Client Credentials request body

I'm working with an API that is requiring user_id be passed in the body of the authorization (token) request.   I cant figure out how to configure the user id value in the authorization settings.  Without this value I'm getting an Unauthorized Client error message.   Can anyone tell me where I can add user_id to the Authorization body request?

 

Example:

x-www-form-urlencoded: scope: <scope>

grant_type: client_credentials

client_id: <client_id>

client_secret: <client_secret>

user_id: <user_id>

 

scope=read&grant_type=client_credentials&user_id=<user_id>&client_id=<client_id>&client_ secret=<client_secret>

  • rom_tunioz's avatar
    rom_tunioz
    New Contributor

    To pass the user_id in the body of your token request, you need to ensure that the API you're working with supports including additional parameters like user_id in the authorization request. Typically, the authorization (token) request includes a body with parameters such as client_id, client_secret, grant_type, etc. If your API explicitly requires user_id, you'll have to configure it accordingly.

    Here’s how you can add user_id to the authorization request body in various situations:

    1. When Using OAuth 2.0 Authorization Code Flow

    In the OAuth 2.0 flow, the authorization request typically includes parameters like grant_type, client_id, client_secret, and sometimes additional data, depending on the specific API.

    If user_id is required, add it to the token request body:

    • Ensure that the user_id is being passed in the body of the POST request to the token endpoint.
  • brandon03's avatar
    brandon03
    New Contributor

    Did this get moved to AlertSite? I'm pretty sure I posted it in SoapUI community.