Using the OAuth Control

I am trying to integrate PureCloud in our .NET website. To control access and show personalized information, I would need the Agent to provide his credentials and connect to PureCloud. To that end, we decided to use the PureCloud API - .NET OAuth Control. I've tried different configurations with OAuth, but the best result I had was a blue frame.

I can't find any error code, or any message to understand what is happening. The only Event that occurs is the Authenticated Event, which calls my function correctly, but with a blank token, and even before the dialog window appears.

I am able to connect using Client Credentials and request data through the API, so it isn't a connectivity problem. I've tried while being connected to PureCloud in another Tab and without being connected, same results. I've even reset the API's configuration just in case, but it doesn't change anything. The form is running in a different thread than the website.

Here is a screen capture of the barren form next to the lines of code calling it.

I just tested out using the form in my test app and it works correctly for me. To troubleshoot, I'd suggest looking at what URLs are being navigated to. The OAuthWebBrowser class implements WebBrowser, so you can register for the standard navigatation events or check the Url property.

Some things to check:

  • Make sure your oauth client is configured for the implicit grant type; the control does not work with the token grant type.
  • If your org isn't in mypurecloud.com, make sure you set the environment property.
  • Make sure your redirect URI is configured correctly on the OAuth client. http://localhost:8080/ is different than http://localhost:8080 (no slash) and will cause an authentication failure.

Out of curiosity, why are you using the oauth browser control in what appears to be a web project? A web page should implement a login process directly; this control is only for desktop applications. There's a tutorial for using the Implicit Grant with ASP.NET.

The Implicit Grant works perfectly fine. Thank you. Sorry for the confusion.