josephtalaat | 2019-02-05 12:26:48 UTC | #1
Dears, Good Day. How can i get the access token dynamically for authorization code grant using java code. According to the following link: https://developer.mypurecloud.com/api/rest/authorization/ I tried to put it as constant string in my code and it worked, however it expires in 24 hours. I can't use code credentials grant because i want to use conversation APIs.
Thanks & Best Regards Joseph Talaat
tim.smith | 2019-02-05 15:11:30 UTC | #2
Users must authorize using the implicit, auth code, or SAML2 Bearer grants. Client Credentials explicitly does not have a user context and cannot access certain APIs, as you have found.
Check out the OAuth With Authorization Code Grant tutorial. While it's not available in Java, it is available in four other languages. The concept is the same in any language.
Access tokens expire in the amount of time configured on your OAuth client, which can be 5 minutes to 48 hours; the default is 24 hours. When your app detects that the access token is invalid, it should re-initiate the authentication process for the user to obtain a new access token. If a valid session cookie exists in the user's browser, they may not be re-prompted for their credentials.
system | 2019-03-08 15:11:32 UTC | #3
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: 4512