authenticate

Authenticate a user to Arkane

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.

Signature

arkaneConnect.flows.authenticate(options?: AuthenticationOptions): Promise<AuthenticationResult>

Returns

Promise<AuthenticationResult>

Parameters

Parameter

Type

Required

Description

options

AuthenticationOptions

False

Provide extra auth options

Examples

// Example 1
// Redirect to the current page
arkaneConnect.flows.authenticate({ windowMode: 'REDIRECT' });
// Example 2
// Redirect to https://foo.io
arkaneConnect.flows.authenticate({ redirectUri: 'https://foo.io', windowMode: 'REDIRECT'});
// Example 3
// Login using popup
arkaneConnect.flows.authenticate({ windowMode: 'POPUP' })
.then((result: AuthenticationResult) => {
result
.authenticated((auth: AuthenticationInstance) => {
alert('logged in: ' + auth.subject);
})
.notAuthenticated((auth: AuthenticationInstance) => {
alert('not logged in');
});
});

Object Types