With the response being:
{"status":403,"code":"forbidden","message":"App not authorized to use scope [organization, organization:readonly]","details":[],"errors":[]}
I copied the command in Curl to see what I get there, and the response was the same.
So I went to check my OAuth Scope settings and I see I already have organization there (I also tried organization:readonly but that didn't work either):
I also checked my Authorized redirect URIs and I have everything there. The forums don't allow me to type them out, but I have localhost 8080, 127 8080, 127 8080 appended by index-template.html, and all of them with and without a trailing slash just in case.
I don't know what I'm missing. I tried adding every single scope, and that didn't work either.
It looks like this may just be a bug with the sample app. I'm able to reproduce this.
Try clicking "authenticate" a second time after being redirected back with an auth token. The second time, you should not see the access token in the URL. (Also be sure to select pca-us as the environment both times). I'll get a ticket created to fix this in the sample application.
Ok, thanks for confirming. It's different from what I was seeing. Logs confirm it's a scopes issue. I'll try to loop in someone who has more information on that.
@crcya It looks like you OAuth client is configured correctly so check to see if your OAuth client has been authorized by visiting https://apps.mypurecloud.com/directory/#/admin/oauth/authorizations and looking for that client in the list. If it is not there, you can authorize it to use those scopes by clicking the "Authorize a Client" button and copy/pasting your client ID in the text box. That will take you to a page where you can authorize the client.
For using the SDK with scopes, You'll need the scopes authorization, conversations, organization, and notifications - I'll work on getting this documented.
Is that the link? If so, I have an integration with the Application URL of http://127.0.0.1:8080, the Application Type as "standalone", and the iframe sandbox options as "allow-scripts,allow-same-origin,allow-forms,allow-modals"
Permissions is still failing, but the /me fails, but then retries(?) and gets a 200. But I still get the following log on the page:
Mon Jul 01 2019 11:22:23 GMT-0700 (Mountain Standard Time)
error
error: Failed to initialize SDK
details: Error: Forbidden
Mon Jul 01 2019 11:22:23 GMT-0700 (Mountain Standard Time)
Error: Failed to initialize SDK
Mon Jul 01 2019 11:25:27 GMT-0700 (Mountain Standard Time)
error
error: Failed to initialize SDK
details: Error: Forbidden
Mon Jul 01 2019 11:25:27 GMT-0700 (Mountain Standard Time)
Error: Failed to initialize SDK
I double-checked and that is the correct link. Perhaps you don't have permission to view that page. Please make sure you have the "oauth:clients:authorize" permission.
Playing around with https://sdk-cdn.mypurecloud.com/webrtc-sdk/demo/webpack/ that's starting just fine to no surprise. Looking at the page source it's using 6b9f791c-86ef-4f7a-af85-3f3520dd0975. How is that client configured? Maybe if I can compare that to mine the difference can be found.
It may be easier to ask your admin to authorize the client for you. I think it's likely that if you don't have access to the Authorized Applications view, you probably won't be able to add permissions to your user.
You can get a URL to the client authorization by visiting your OAuth client config and scrolling down to the area that displays your client ID and secret. There is a text box containing a URL.
That worked! I am the admin and still can't access /oauth/authorizations, but going to that authorization URL specifically works and I enabled them. The demo page is now working! Can we get that documented somewhere? That seems really important.
A behavior I wasn't expecting was I still have to keep my PureCloud login tab open. I can enter a number into the "Outbound phone call" field of the demo page and dial out, but the call connects in the PureCloud tab. And I'm able to end the call from the demo page too. Is there a way to get around keeping the PureCloud tab open?