What do you mean my authorization scheme isn't supported? #2158
Locked
aruniverse
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
tl;dr
If you'd like to use iTwin.js along with the rest of our iTwin Platform APIs, you'll need to change the OIDC Issuing Authority from imsoidc.bentley.com to ims.bentley.com, along with adding the new
itwinjsscope under theVisualization API Associationin your client's registration at developer.bentley.comNew OIDC Authority
Recently a change was made in the iTwin Developer Portal to simplify authorization and the usage of our APIs; namely consolidating some scopes and the authority.
You might have seen the following error when trying to use one of our API's, "Authorization scheme is not supported", due to a mismatch in the OIDC authority that issues your auth token.
The iTwin Platform currently supports two different OIDC issuing authorities for requesting an access token;
imsoidc.bentley.comandims.bentley.com.The
imsoidcissuer has been the main authority used over the past few years for iTwin.js and issuing tokens that allowed contacting all of the services required to make your application (We'll refer to these as the initial APIs). This authority allowed you to get an access token with the following set of scopes that granted you access to their respective services:rbac-user:external-clientprojectwise-shareimodeljs-routergeneral-purpose-imodeljs-backendproduct-setting-servicecontext-registry-service:read-onlyimodelhuburlps-third-partyreality-data:readWith the recent release of iTwin Platform APIs, a new OIDC authority has been introduced,
ims.bentley.com. This new authority, initially, issued you an access token that could be used with all of the new iTwin Platform APIs but did not allow you to contact any of the "initial APIs" listed above that iTwin.js still uses. So previously, users would have to manage two different tokens issued by the two different authorities above, one to use the "initial APIs" and another for the iTwin Platform APIs.This was a pain, so we have introduced a new way of getting an access token for the "initial APIs". We've added the
itwinjsscope as a supported scope on the newimsauthority. This scope technically wraps up all of the scopes listed above and if you request an access token with just that single scope it will have access to call any and all of the "initial APIs".So now, the recommended workflow is to always use the new authority,
ims.bentley.com, and theitwinjsscope to call any of the "initial APIs". This will allow you to remove from your list any of the 9 scopes above you were previously requesting and then once you start using the new iTwin Platform APIs, it can all be handled with a single access token rather than two, resolving the "Authorization scheme is not supported" error.To learn more about our platform's authentication workflow, please refer to this overview. You can also inspect your auth token at jwt.ms to learn more.
To recap:
Previously
Issuer:
imsoidc.bentley.comScopes:
rbac-user:external-clientprojectwise-shareimodeljs-routergeneral-purpose-imodeljs-backendproduct-setting-servicecontext-registry-service:read-onlyimodelhuburlps-third-partyreality-data:readNow
Issuer:
ims.bentley.comScopes:
itwinjsSo what does this mean for you as a developer?
Are you just getting started out with your first application powered by iTwin.js?
If so, you're in luck; both our Web and Desktop viewer templates use the new
imsissuer by default. You can follow the getting started guides for Web and Desktop and start building an application powered by iTwin.js and our Platform.Do you have an existing application?
Visualization API Associationadd theitwinjsscope to your app, then click save.itiwnjsscope and use the new auth issuer,https://ims.bentley.com. (You can remove any and all of the 9 scopes required for the oldimsoidcissuer.)For Web Apps:
If you're using the iTwin Web Viewer, you'll need to update the
authConfigobject that's passed into theViewercomponent to add the authority like so:For Desktop Apps:
You'll want to make sure the NativeAppAuthorization singleton is initialized with the issuerUrl pointing to the new issuer.
If you're using the iTwin Desktop Viewer, you'll need to update the
electronHost.authConfigobject to add the issuer like so:You'll need to clear out the cached auth token in Windows Credential Manager or MacOS KeyChain. They key will include your desktop app's client id.
For Service Apps (using client-credentials):
imjs_itwin_platform_authorityand set it to the new issuer.Beta Was this translation helpful? Give feedback.
All reactions