This function will check if the user is authenticated and if not, ask the user to authenticate.
arkaneConnect.flows.authenticate({ windowMode: 'REDIRECT' });
If windowMode
= 'REDIRECT', the user will be redirected to options.redirectUri
with the result after logging in.
If windowMode
= 'POPUP', the popup will close and the promise resolved when the user finishes the request. No extra options are required.
If you set the redirectUri
option, make sure that the SDK and the AuthenticationResult
handling is also present on the page you redirect to.
arkaneConnect.flows.authenticate(options?: AuthenticationOptions): Promise<AuthenticationResult>
Promise<AuthenticationResult>
Parameter | Type | Required | Description |
|
| Provide extra auth options |
// Example 1// Redirect to the current pagearkaneConnect.flows.authenticate({ windowMode: 'REDIRECT' });
// Example 2// Redirect to https://foo.ioarkaneConnect.flows.authenticate({ redirectUri: 'https://foo.io', windowMode: 'REDIRECT'});
// Example 3// Login using popuparkaneConnect.flows.authenticate({ windowMode: 'POPUP' }).then((result: AuthenticationResult) => {result.authenticated((auth: AuthenticationInstance) => {alert('logged in: ' + auth.subject);}).notAuthenticated((auth: AuthenticationInstance) => {alert('not logged in');});});