NylasConnect.callback()
is a simplified callback handler that works for both pop-up and inline authentication flows. This is a convenience method that automatically detects the callback type and handles it appropriately.
// Simplified callback handlerconst result = await nylasConnect.callback();// Or with a specific URLconst result = await nylasConnect.callback(customUrl);
You can pass no parameters to the method if you want to handle the callback using the current window location. If you want to use a specific URL, pass it as a parameter.
Property | Type | Description |
---|---|---|
url | string? | The URL to process. If not provided, Nylas Connect uses the current window location. |
Return value
Section titled “Return value”The callback()
method returns a Promise<ConnectResult>
with the following properties.
Property | Type | Description |
---|---|---|
accessToken | string | The access token associated with the user’s grant. |
expiresAt | number | When the access token will expire, in seconds using the Unix timestamp format. |
grantId | string | A unique identifier for the user’s grant. |
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
Section titled “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. |