login()
function login(params: {
clientId: string;
isConsumerUser: boolean;
responseType: string;
scope: 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
isConsumerUser
boolean
Whether user is a consumer user
responseType
string
OAuth response type (typically 'code')
scope
string
OAuth scopes (e.g., 'openid profile email')
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
}