NylasConnect.validateToken()
validates an access token by making a test request to the Nylas APIs.
// Validate current stored tokenconst isValid = await nylasConnect.validateToken();// Or validate a specific tokenconst 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.
Parameter | Type | Description |
---|---|---|
token | string? | An access token to validate. If not provided, Nylas Connect uses the currently stored token. |
Return value
Section titled “Return value”The validateToken()
method returns a Promise<boolean>
. When true
, it indicates that the token is valid and active.