# NylasConnect.handleRedirectCallback()

Source: https://developer.nylas.com/docs/v3/auth/nylas-connect/nylasconnect-class/callback-methods/nylasconnect-handleredirectcallback/

`NylasConnect.handleRedirectCallback()` handles the OAuth redirect callback after completing the [inline authentication flow](/docs/v3/auth/nylas-connect/#set-up-basic-authentication-using-inline-flow). This method processes the authorization `code` and exchanges it for tokens.

> **Inline flow only:** 
> `handleRedirectCallback()` only works with the **inline** authentication method. It does **not** work with the popup method. If you need to handle callbacks for both popup and inline methods, or if you're handling callbacks on the backend, use [`callback()`](/docs/v3/auth/nylas-connect/nylasconnect-class/callback-methods/nylasconnect-callback/) instead.

## Usage

```ts [usage-Browser (inline method only)]
// Handle callback after OAuth redirect (inline method only)
const result = await nylasConnect.handleRedirectCallback();
// Or with a specific URL
const result = await nylasConnect.handleRedirectCallback(window.location.href);
```

## When to use

Use `handleRedirectCallback()` when:

- You're using the **inline** authentication method (full page redirect)
- You're handling the callback in the **browser** (not on the backend)
- You want method-specific callback handling

For most use cases, especially backend handling or popup support, use [`callback()`](/docs/v3/auth/nylas-connect/nylasconnect-class/callback-methods/nylasconnect-callback/) instead.

## Parameters

| Parameter | Type    | Description                                                                          |
| --------- | ------- | ------------------------------------------------------------------------------------ |
| `url`     | string? | The URL to process. If not provided, Nylas Connect uses the current window location. |

## Return value

The `handleRedirectCallback()` method returns a `Promise<ConnectResult>` with the following properties.

| Parameter     | Type                       | Description                                                                         |
| ------------- | -------------------------- | ----------------------------------------------------------------------------------- |
| `accessToken` | string                     | The access token associated with the user's grant.                                  |
| `expiresAt`   | number                     | When the access token will expire, in milliseconds using the Unix timestamp format. |
| `grantId`     | string                     | A unique identifier for the user's grant.                                           |
| `grantInfo`   | [`GrantInfo?`](#grantinfo) | Optional grant information from the `idToken`.                                      |
| `idToken`     | string                     | An ID token containing information about the user.                                  |
| `scope`       | string                     | A space-delimited list of scopes associated with the user's grant.                  |

### `GrantInfo`

| Property        | Type     | Description                                                            |
| --------------- | -------- | ---------------------------------------------------------------------- |
| `email`         | string   | The email address associated with the grant.                           |
| `emailVerified` | boolean? | When `true`, indicates that the user has verified their email address. |
| `familyName`    | string?  | The user's surname (last name).                                        |
| `givenName`     | string?  | The user's given (first) name.                                         |
| `id`            | string   | A unique identifier for the user's grant.                              |
| `name`          | string?  | The user's display name.                                               |
| `picture`       | string?  | A URL that links to the user's profile picture.                        |
| `provider`      | string   | The OAuth provider that the user authenticated with.                   |