Example: Enable Bentley IMS Login

The example below has an extra Sign In to 3DM Cloud (Bentley IMS) option available.



Preparations

1. SPA Client Registration

To get started, your application needs to be registered with the Bentley IMS to use the iTwin Platform APIs.
You can do so here : https://https://developer.bentley.com/register

Enter the following information :

After creating the client, we will now manage it from a different place.
Navigate to https://imsoidcui.bentley.com and select “Manage Applications”.

Here, edit the client you just created using the “Edit” Action :

Update the following elements :

2. Callback document

A callback document must be made available. The URL to this document will be used to hand off the authorization code to the application.

SDK Initialisation

To enable the option to login in using Bentley IMS, you need to provide these options at startup :

var options= new AMap();
options.set(Constants.STARTUP_BENTLEY_IMS_ENABLE,true);
options.set(Constants.STARTUP_BENTLEY_IMS_CLIENT_ID,"<your-client-id>");
options.set(Constants.STARTUP_BENTLEY_IMS_REDIRECT_URL,"<your-callback-handler-url>");
let viewer = new SDKViewer("app name",divElement,options);