NylasConnect.isConnected()
checks if a grant is currently connected to Nylas and has a valid access token.
// Check if current session is connectedconst connected = await nylasConnect.isConnected();// Or check a specific grantconst connected = await nylasConnect.isConnected('<NYLAS_GRANT_ID>');
You can pass no parameters to the method if you want to check the grant associated with the current session. If you want to check 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 associated with the current session. |
Return value
Section titled “Return value”The isConnected()
method returns a Promise<boolean>
. When true
, it indicates that the grant is connected and has a valid access token.