About the 'auth_code' Argument in the apiclient.get_code_authorization_token Function

Hello,

I have a question about the sample code for Authorization Code Grant on this page. Where should I obtain the data to be input as the 'auth_code' argument for the apiclient.get_code_authorization_token function?
My goal is to obtain a new access token using a refresh token.

If you follow your link above and click on the Authorization Code Grant doc link, that page documents how to use the auth code grant. In the Get the OAuth Client Information section, it describes how to create and obtain the oauth client information.

lxlhrbr,

I ran into this confusion as well when I first started using the auth code grand with the SDK. In the document Tim mentioned it shows that you need to first send your user to the following address

Https://login.(host URL)/oauth/authorize

The host URL will depend on where your org is located. All of the info in the documentation is "mypurecloud.com" which is us-east-1. You will need to change that part to your region if you are not in us-east-1. There is a listing on this page under the "Core Regions" tab AWS regions for Genesys Cloud - Genesys Cloud Resource Center

Next, you will need to add the following parameters to the URL client_id, response_type, and redirect_uri.

The client ID will be your OAuth's ID, the response_type will be "code", and the redirect_uri will be the address you want the response to this call to be directed to. It should look something like this:

Https://login.mypurecloud.com/oauth/authorize?client_id=yourClientId&response_type=code&redirect_uri=yourRedirectUri

Once you direct the user to this URL they will be prompted for a Genesys login unless they are already logged in. You can force a login by adding &prompt=login to the end of the example URL.

Once they successfully log in Genesys will send them back to the URL you provided in the redirect URI with a code parameter attached to the end of the URL

example - https://yourUrl.com?code=generatedCode

This will be the auth code that you are passing to the SDK.

Hopefully that makes sense, and I believe it is all in the documentation. But I do recall struggling with it myself when I first tried to set it up.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.