NylasConnect.getGrantInfo()
retrieves grant information from a stored token, including user details and provider information.
// Get grant info for current sessionconst grantInfo = await nylasConnect.getGrantInfo();// Or for a specific grantconst grantInfo = await nylasConnect.getGrantInfo('<NYLAS_GRANT_ID>');
You can pass no parameters to the method if you want to get information about the grant associated with the current session. If you want to get information about a specific grant, pass it as a parameter.
Parameter | Type | Description |
---|---|---|
grantId | string? | The ID of the grant to access. If not provided, Nylas Connect uses the grant ID associated with the current session. |
Return value
Section titled “Return value”The getGrantInfo()
method returns a Promise<GrantInfo | null>
with the following properties.
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. |
If no grant information is available, the method returns null
.