I have developed a Custom Widget using ArcGIS Experience Builder Developer Edition v1.19. We deploy a custom experience on our Server (say https://example.com) where Users have to Login using our Organisation's ArcGIS Online Named Users, and once they have logged in, Other pages of the application open, and they can access data from maps and services which are accessible only to the Organization.
My custom widget for Loging in, uses the session manager and has code like this:
const handleClick = async () => {
const sm = SessionManager.getInstance()
const mainSession = sm.getMainSession()
if(mainSession) {
console.log('Already signed in', mainSession)
checkUserAndOpen()
}else{
sm.signIn({clientId: appId, desUrl : 'https://MyOrg.maps.arcgis.com'}).then(credential => {
if (credential) {
checkUserAndOpen()
}
}).catch(error => {
console.error('Error during sign-in:', error)
alert('Login failed. Please try again.')
})
}
}
The problem with this code is that the OAuth Login window that is opened is the standard ArcGIS Online Login Screen, and not my Organisation's Login Screen.
This is a dealbreaker, because we have now implemented OIDC based Single Sign On, and unless users specifically put in the Organisation URL, they don't get the Button for logging in with their SSO.
I looked at the docs for the SignInParms, and it is like this in `client\jimu-core\lib\session-manager.d.ts`
interface SignInParams {
/** The portal URL to sign-in to. This is optional. The default is the main portal URL. To sign-in a federated service URL, you need to pass in its federated portal URL. */
desUrl?: string;
/** The URL that the sign-in request comes from. This is optional. The default is the root path. */
fromUrl?: string;
/** The OAuth2 client id. */
clientId?: string;
/** If 'true', will use a popup window to sign-in, if 'false', it will redirect to sign-in page in the same window. This is optional. The default is true. */
popup?: boolean;
/** If 'true', the sign-in page will prompt again even the user has already signed-in. This is optional. The default is false. */
forceLogin?: boolean;
/** The url of federated service if sign in to a federated service. Optional. @ignore */
federatedServiceUrl?: string;
/** The url opened in a new window after sign-in. Optional. */
redirectUrlInNewWindow?: string;
/** The url opened in the top window after sign-in. Optional. When the top window is refreshed, the current window (fromUrl) will not see the refresh effect. */
redirectUrlInTopWindow?: string;
}
Is there a reason why the desURL is not being used?