Genesys Cloud - Main

 View Only

Discussion Thread View
  • 1.  Cannot obtain API token

    Posted 02-04-2025 17:56

    Hey everyone,

    Apologies if this has already been addressed but am new to the Genesys platform and trying to sort through some of the APIs available.  In that, I am having difficulty obtaining the token.  I have created the OAuth client in Genesys Admin with a grant type as 'Client Credentials'.  When making the call via Postman as well as the example they provide for Python I am getting a 400 returned.  

    The following headers are defined:

    Content-Type : application/x-www-form-urlencoded

    Authorization: Basic (base64)

    I have tried both x-www-form-urlencoded and raw as the Body when sending 

    {
      "grant_type": "client_credentials"
    }

    Can anyone point me in the right direction here?

    Thanks for the assistance!


    #API/Integrations

    ------------------------------
    Chad
    ------------------------------


  • 2.  RE: Cannot obtain API token

    Posted 02-05-2025 07:06

    Hello,

    What 400 response are you getting?

    400 could be returned for several reasons.



    ------------------------------
    Jan Heinonen
    Contact Center Specialist
    GlobalConnect AB
    ------------------------------



  • 3.  RE: Cannot obtain API token

    Posted 02-05-2025 08:15

    Here is the error that is returned.

    {
        "error": "invalid_request"
    }



    ------------------------------
    Chad Meyer
    Global Voice Engineer
    ------------------------------



  • 4.  RE: Cannot obtain API token

    Posted 02-05-2025 08:21

    Which API are you using and what does the request look like?



    ------------------------------
    Jan Heinonen
    Contact Center Specialist
    GlobalConnect AB
    ------------------------------



  • 5.  RE: Cannot obtain API token

    Posted 02-05-2025 08:29

    It is a POST method to https://login.mypurecloud.com/oauth/token

    Headers:
    Content-Type : application/x-www-form-urlencoded
    Authorization : <clientID:secret defined in Basic Auth> which auto converts to base64

    Body:


    {
      "grant_type": "client_credentials"
    }



    ------------------------------
    Chad Meyer
    Global Voice Engineer
    ------------------------------



  • 6.  RE: Cannot obtain API token

    Posted 02-05-2025 09:03

    Which AWS region is your Genesys Org in?



    ------------------------------
    Jan Heinonen
    Contact Center Specialist
    GlobalConnect AB
    ------------------------------



  • 7.  RE: Cannot obtain API token
    Best Answer

    Posted 02-05-2025 10:12

    We are in US West 2.

    shrug - Changing the endpoint to https://login.usw2.pure.cloud/oauth/token worked for me.  Per the doc at https://developer.genesys.cloud/authorization/platform-auth/guides/oauth-client-credentials-guide it states to point it at https://login.mypurecloud.com/oauth/token.  

    Thank you for the assistance!



    ------------------------------
    Chad Meyer
    Global Voice Engineer
    ------------------------------



Need Help finding something?

Check out the Genesys Knowledge Network - your all-in-one access point for Genesys resources