oAuth Create Callback without Purecloud login redirect and prompt

Hello,

I am trying to add a "Book a callback" option to the website when chat is unavailable (offline schedule). The users accessing this website are non-Purecloud users and do not have a Purecloud login. Essentially when a user clicks "Book a callback" button after entering their name and phone number, I want the api call to register a callback.

I tried following the documentation on the API->Tutorials->Create Callback page but by using the loginImplicitGrant (for Token Implicit Grant) passing in client id and redirect url. The issue is that each time I try to execute this, it complains that I am not authorized, though I have the client id, client secret and redirect url.

1: Is it possible to do a silent authentication, i.e. without having a non-Purecloud user redirected to the Purecloud login screen?
2: If so, can I achieve this initial authentication via a C#.Net MVC Controller api call?

I did come across this link https://developer.mypurecloud.com/api/tutorials/oauth-implicit/?language=javascript&step=1 but both Javascript and C# options define a redirect to the Purecloud login prompt which is non ideal
I also did come across a suggestion from Tim at this link https://developer.mypurecloud.com/forum/t/webcallback-in-javascript/3949/3 but that option does not work for us with our current technical landscape.

3: Will changing the grant type to Client Credentials Grant make things easier?

All we want to do is to provide general non-Purecloud users an option to register a callback in scenarios where a chat agent is not available. We have created the oAuth client and have the client id and client secret.

At this stage, the two available options are either implement using Javascript or C# MVC controller or a combination of both. We cannot use Nodejs or any other middleware option.

Any pointers will definitely help.

Thanks

There is no way to make unauthenticated requests to create callbacks. You must implement the authenticated API call inside some private part of your application/service as well as handling the request from your public website into the private part of the application.

As you've found, the public stats service open source project demonstrates how to create a callback in this manner. You are free to use any combination of languages and technologies that best suit your needs as long as your architecture satisfies the requirement that the PureCloud API request and authentication are handled server-side. Publishing your client secret in your web app is a security violation and will result in the oauth client being revoked.

You can request the feature to make unauthenticated callback requests at https://purecloud.ideas.aha.io/ideas.

Thanks Tim. I realized that I was using the wrong grant type and using Client Credentials grant type without exposing sensitive data (all api calls in a private part of the app) worked perfectly.

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