JS WEB API Token Authentication

Im working on some code that will allow me to access "https://api.mypurecloud.com/api/v2/externalcontacts/contacts/"

From my understanding this is about 95% of what I need.
https://developer.mypurecloud.com/api/tutorials/oauth-implicit/?language=javascript&step=1

I have the ID, and I am not sure what to do with the Redirect_url
What else do I need to do to properly get the token/authentication to then start doing requests.

If you are planning to authenticate using Implicit Grant, then that implies that you will be developing a user-facing, web-based UI. That web-based UI will be some HTML/CSS/JS that is hosted somewhere, such as https://www.myserver.com/MyCustomApplication.

When the user accesses you application hosted at the location above, the Implict Grant flow will redirect your browser to PureCloud to allow the user to enter their credentials. Once they successfully login, PureCloud will redirect back to your application using the redirect_uri. You could redirect back to the original application URL listed above, or you could redirect back to a different page. In either case, the access token will be contained in the hash of the URL and your page will have to retrieve that access token to use for any subsequent API requests.

This is all described here with some good illustrations and examples: https://developer.mypurecloud.com/api/rest/authorization/use-implicit-grant.html

Hope that helps.

I must be looking at the wrong authentication then. I'm looking for a type of authentication where I can interface with the API through a web browser only, acquire the token, and then pull some data out of the 'https://api.mypurecloud.com/api/v2/externalcontacts/contacts/'

I have my credentials needed for the API. Just need to find the correct one for authentication

This is all described here with some good illustrations and examples: https://developer.mypurecloud.com/api/rest/authorization/use-implicit-grant.html

If you're using the JavaScript SDK, it has a helper for the implicit grant: https://developer.mypurecloud.com/api/rest/client-libraries/javascript/index.html#authentication

Thanks,

So essentially I should just be able to copy/paste the code for the web implicit grant and it should function properly?

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