Wang_Jiajun | 2021-12-07 07:33:33 UTC | #1
Do you know which part I missed? Body or headers?
anon11147534 | 2021-12-07 08:13:27 UTC | #2
Hi,
I'll assume you're using client credentials. Your headers and body are wrong. Please review the following article for reference: Grant - Client Credentials
Wang_Jiajun | 2021-12-07 14:39:13 UTC | #3
Can you please give me the sample for the headers and body?
anon11147534 | 2021-12-07 15:51:57 UTC | #4
Headers:
Host: login.mypurecloud.jp
Content-Type: application/x-www-form-urlencoded
Authorization: Basic BASE64(<client_id>:<client_secret>)
BASE64(<client_id>:<client_secret>) means you need to base64 encode your clientId and secret in the format <client_id>:<client_secret>
Body:
grant_type=client_credentials
anon11147534 | 2021-12-07 15:53:12 UTC | #5
See How to Use Base 64 Encoding for help on using Base4 encoding
yuezhong | 2021-12-07 23:16:25 UTC | #6
in your Web1 request, Headers, only keep 'Content-type: applicaiton/x-www-form-urlencoded, remove others. body granttype=clientcredentials
select Authentication Basic (at the bottom), username = Client id, password=client secret.
Wang_Jiajun | 2021-12-08 06:27:24 UTC | #7
Hi all Thank you all for the reply. It works now. I retrieved the access token by web activity successfully.
Please let me confirm with you one thing, as access token will be expired in 2 days, can I retrieve the refreshed access token by this method?
If i need to refresh it before retrieving access token when it expires, Can you give me the sample for refreshing? Headers and body
anon11147534 | 2021-12-09 08:41:16 UTC | #8
You have to use the exact same method to get a new access token when/before this one expires.
system | 2022-01-09 08:41:28 UTC | #9
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: 12862