charaf_ed | 2019-12-18 22:48:48 UTC | #1
Hello,
I'm trying to create a Python application to get number of On-Queue Agents using PureCloud SDK.
I've followed the steps described in the link below : https://developer.mypurecloud.com/api/tutorials/number-of-agent-in-queue/?language=python&step=2
But, I am facing 2 errors:
- In step 2, to obtain an Access Token, I need to make a POST call to https://login.mypureclud.De/oauth/token, and I got an error : Method Not Allowed
- When Running my Python program, I got an error in the line holding the Client ID & Secret ID
Appreciate you help !
CHARAF
tim.smith | 2019-12-18 22:55:33 UTC | #2
charaf_ed, post:1, topic:6768
In step 2, to obtain an Access Token, I need to make a POST call to https://login.mypureclud.De/oauth/token, and I got an error : Method Not Allowed
Can you share your code that's causing this? The SDK is coded to make the proper request. If you're using the SDK's auth helper, it shouldn't be possible to make a request using an incorrect HTTP method.
charaf_ed, post:1, topic:6768
When Running my Python program, I got an error in the line holding the Client ID & Secret ID
os.environ['PURECLOUD_CLIENT_ID'] gets the value of the environment variable PURECLOUD_CLIENT_ID. It looks like you replaced the name of the environment variables with your client id and secret. If you're going to hardcode the values, just use the hardcoded values and do not attempt to retrieve them from environment variables.
charaf_ed | 2019-12-19 10:04:12 UTC | #3
quote="tim.smith, post:2, topic:6768"] Can you share your code that's causing this? The SDK is coded to make the proper request. If you're using the [SDK's auth helper, it shouldn't be possible to make a request using an incorrect HTTP method.
charaf_ed: [/quote] I just clicked in the link https://login.mypurecloud.de/oauth/token . Where I can find code that cause this ?
tim.smith, post:2, topic:6768
os.environ['PURECLOUD_CLIENT_ID'] gets the value of the environment variable PURECLOUD_CLIENT_ID . It looks like you replaced the name of the environment variables with your client id and secret. If you're going to hardcode the values, just use the hardcoded values and do not attempt to retrieve them from environment variables.
You're right, I replaced the name of the environment variables with my client ID & secret ID generated in PureCloud. How my application will authenticate in my case without replacing the variables ?
Appreciate your help
CHARAF
tim.smith | 2019-12-19 15:06:46 UTC | #4
charaf_ed, post:3, topic:6768
I just clicked in the link https://login.mypurecloud.de/oauth/token . Where I can find code that cause this ?
I'm not sure what you're talking about. You're writing a Python script, correct? In that context, I don't understand where you're clicking a link for anything.
charaf_ed, post:3, topic:6768
How my application will authenticate in my case without replacing the variables ?
The tutorial retrieves the client credentials from environment variables. You're welcome to write your app however you like to handle your client credentials. Just remember that the client secret should be handled like a password.
charaf_ed | 2019-12-19 15:28:54 UTC | #5
I added the code used here to authenticate my request ( https://developer.mypurecloud.com.au/api/tutorials/oauth-client-credentials/?language=python&step=1)
So, after running my Python script, I'm not getting the errors anymore but nothing seems to happen
Here is the response :
charaf_ed | 2019-12-19 15:30:30 UTC | #6
The API call should get the users of the queue with the desired routing status. ("IDLE", "INTERACTING") though !
tim.smith | 2019-12-19 15:33:45 UTC | #7
That tutorial is for when you're explicitly not using the SDK. Please follow the SDK's documentation and the SDK tutorials (e.g. the one you linked in your first post) for how to authenticate with the SDK.
system | 2020-01-19 15:33:49 UTC | #8
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 6768