Skip to content

NylasConnect.validateToken()

NylasConnect.validateToken() validates an access token by making a test request to the Nylas APIs.

// Validate current stored token
const isValid = await nylasConnect.validateToken();
// Or validate a specific token
const isValid = await nylasConnect.validateToken('<NYLAS_ACCESS_TOKEN>');

You can pass no parameters to the method if you want to validate the currently stored access token. If you want to validate a specific access token, pass it as a parameter.

ParameterTypeDescription
tokenstring?An access token to validate. If not provided, Nylas Connect uses the currently stored token.

The validateToken() method returns a Promise<boolean>. When true, it indicates that the token is valid and active.