andygunther | 2017-05-07 13:28:44 UTC | #1
Using the example in the Dev Resource Center, I have the following code that I use to let me login an application to PureCloud with an Implicit Grant OAuth Client:
private void btnLogin_Click(object sender, EventArgs e) { webBrowser1.BringToFront(); webBrowser1.Visible = true;
//Redirect the browser to the login window. webBrowser1.Url = new Uri("https://login.mypurecloud.com/oauth/authorize?" + "responsetype=token" + "&clientid=" + tbClientId.Text + "&redirect_uri=http://localhost:8085/oauth2/callback"); }
It seems, however, that the Client Id doesn't enforce that I go to the correct Org.
In my case, on my test machine, I'm actively working in three different Orgs on a regular basis.
No matter what Org the Client Id I send is from, I always wind up in the last Org I was logged into - just like with a regular browser session.
Is there a code equivalent way to set the Org Name here also?
KevinGlinski | 2017-05-08 00:26:52 UTC | #2
implicit and auth code client ids identify an app, not an org, so any user can log in from any org. client credentials are specific to the org they were created in.
andygunther | 2017-05-08 00:38:27 UTC | #3
I use the same credentials in all Orgs we support, so I don't have to support a different email for every Org. Is there a way to specify the org I want to login to with an Implicit Grant OAuth Client?
KevinGlinski | 2017-05-08 13:42:29 UTC | #4
you specify the org at the login.mypurecloud screen. If your app is sending you to login.mypc and then the login is redirecting you right back to your app then the login page has your session cached so will reuse your last user. You'll have to use a different browser/incognito mode to relogin.
you can specify an org on your login uri https://developer.mypurecloud.com/api/rest/authorization/additional-parameters.html, not sure if it will work the login caching your last login
andygunther | 2017-05-08 13:50:56 UTC | #5
Thanks for that - but specifying the Org Name apparently doesn't do anything to override the cached session. Any other thoughts? I'll look into whether I can establish something like Incognito mode on the Web Browser control in .Net.
KevinGlinski | 2017-05-08 13:52:09 UTC | #6
look to see if you can clear the browser cache/cookies/localstorage for the mypurecloud or all domains.
system | 2017-06-08 14:04:57 UTC | #7
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: 1264