Pure Cloud Cannot Authenticate you at this time

Hi,

When we are trying to request for a new Token from post man accessing the Analytics API, we are receiving below error

https://api.{{environment}}/api/v2/analytics/reporting/schedules

Error Message:

Please note that we just followed the steps from the website

https://developer.mypurecloud.com/api/rest/postman/

Can you please advise on the error message and how to fix it?

Regards
Srikanth Sunkara

Can you provide screenshots of your postman configuration please?

Make sure your oauth client is configured as a auth code grant and make sure that the environment variable is set to mypurecloud.com.au (I'm assuming that's your region based on your profile config). Also, keep in mind that OAuth clients do not span regions, so you have to have created it in the same region you're using to log in. Beyond that, inspect the postman page and see if you can get more information from the network requests.

Thanks! Tim. I have set the environment variable now and also changed grant type to client credentials as we have the same settings under Oauth. I could able to access some of the resources API calls.

I have a new issue where i am trying to call using postman and i receive
{"status":403,"code":"not.authorized","message":"You are not authorized to perform the requested action."}

Can you please advise?

Request URL:https://api.mypurecloud.com.au/api/v2/analytics/conversations/df317a35-ca43-4cfd-a59e-ac38a8d6c104/details

Request Headers

:authority:api.mypurecloud.com.au
:method:GET
:path:/api/v2/analytics/conversations/df317a35-ca43-4cfd-a59e-ac38a8d6c104/details
:scheme:https
accept:/
accept-encoding:gzip, deflate, br
accept-language:en-US,en;q=0.8
authorization:Bearer VKSAsW-wZX8ewykAl49jdq8mNR8Hklxb4G83oEOnjujEDJXKi6IopjfRU4Ak_tt8Yax_9zVPmUq6fI9D4oAsGg
cache-control:no-cache
content-type:application/json
postman-token:367847bf-5597-0016-8e6f-ea10cdc026e3
user-agent:Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36

Response Headers

cache-control:no-cache, no-store, must-revalidate
content-length:106
content-type:application/json
date:Mon, 25 Sep 2017 02:15:49 GMT
expires:0
inin-correlation-id:cb9254e3-42ca-43b3-a87d-62d0f694ea1e
inin-ratelimit-allowed:300
inin-ratelimit-count:1
inin-ratelimit-reset:60
pragma:no-cache
status:403

Hi,

That's a permission related issue. I would check the role you assigned to the OAuth configured in PureCloud. Make sure that the role you assigned has these permissions:

1 Like

Additionally, the required permissions are documented on this resource:

GET /api/v2/analytics/conversations/{conversationId}/details

1 Like

Thanks! Kripette. I will check with my admin team.

Can you please check the role i am assigned is sufficient to access the APIs?

Looks like you have the required permission based on what Tim said. If you are using other endpoints on the API you need to check that you meet those requirements as well, but you should be able to make requests to /api/v2/analytics/conversations/{conversationId}/details

Keep in mind that the request you're making (the one posted above) is using client credentials for authorization. The role assigned to the OAuth client is how permissions will be determined; your user's configuration is irrelevant because your user isn't making that request.

yeah Tim. I understand now. so how can I make a request using client credentials to resolve the error. currently I am getting unauthorized permission. Do I need to switch to authorization code? My only concern is if I change the settings in pure cloud to authorization grant type, it impacts the current apex code as it is using client credentials to make an API Call?

If you're using client credentials, assign the required permissions to the role that's assigned to that oauth client.

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