Use NylasConnect.connect()
to authenticate a user through the OAuth 2.0 flow.
const result = await nylasConnect.connect({ method: "popup" });
You can pass the following options to customize the authentication flow.
Property
Toggle details
Return value
Section titled “Return value”NylasConnect.connect()
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. |