Skip to main content

login()

function login(params: {
clientId: string;
disableRememberMe?: boolean;
instanceId?: number;
isConsumerUser: boolean;
isSSO?: boolean;
responseType: string;
scope: string;
siteId?: number;
useCompactIdpPage?: boolean;
userId?: string;
}): Promise<{
authorized: boolean;
}>;

Initiates the login flow using OAuth/OIDC authorization code flow. If authorization code is present in URL, completes the authorization. Otherwise, redirects to the identity provider's login page.

Parameters

params

Login parameters

clientId

string

OAuth client ID

disableRememberMe?

boolean

(Optional) Whether to disable the "Remember Me" option.

instanceId?

number

(Optional) The instance identifier.

isConsumerUser

boolean

Whether user is a consumer user

isSSO?

boolean

(Optional). Determines whether to use SSO or not.

responseType

string

OAuth response type (typically 'code')

scope

string

OAuth scopes (e.g., 'openid profile email')

siteId?

number

(Optional) The site identifier.

useCompactIdpPage?

boolean

(Optional). Determines whether to use a compact or full IDP page.

userId?

string

(Optional) The user identifier.

Returns

Promise<{ authorized: boolean; }>

Promise with authorization status

Example

const result = await login({
clientId: 'my-app',
scope: 'openid profile',
responseType: 'code',
isConsumerUser: false
});
if (result.authorized) {
// User is now logged in
}