Skip to content

NylasConnect.isConnected()

NylasConnect.isConnected() checks if a grant is currently connected to Nylas and has a valid access token.

// Check if current session is connected
const connected = await nylasConnect.isConnected();
// Or check a specific grant
const 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.

ParameterTypeDescription
grantIdstring?The ID of the grant to access. If not provided, Nylas Connect uses the grant associated with the current session.

The isConnected() method returns a Promise<boolean>. When true, it indicates that the grant is connected and has a valid access token.