Skip to main content

# authorize()

    function authorize(params: {
      clientId: string;
      code: string;
      isConsumerUser: boolean;
      redirectUri: string;
      responseType: string;
      scope: string;
    }): Promise<void>;

Handles the OAuth authorization callback after redirect from IDP. Exchanges authorization code for access token and initializes user session.

## Parameters​

### params​

Authorization parameters

#### clientId​

`string`

OAuth client ID

#### code​

`string`

Authorization code from IDP

#### isConsumerUser​

`boolean`

Whether user is a consumer user

#### redirectUri​

`string`

Redirect URI used in OAuth flow

#### responseType​

`string`

OAuth response type

#### scope​

`string`

OAuth scopes

## Returns​

`Promise`<`void`>

## Example​

    await authorize({
      clientId: 'my-app',
      code: 'auth-code-from-url',
      redirectUri: window.location.origin,
      scope: 'openid',
      responseType: 'code',
      isConsumerUser: false
    });