Account Reauthentications
By using an account's sync_state
, you can determine when the user should reauthenticate their account. A user may need to reauthenticate for a number of reasons. For example, it could be that their password changed, or it may also be that Nylas' access was revoked by the server.
Aside from the sync status info provided in the Nylas Dashboard, you can determine an account's sync_state
using the API.
Current Sync State
Using the API, there are three ways to find a Nylas account's current sync_state
.
Account Endpoint Poll Requests
Make poll requests to /account endpoint and check sync_state
. If invalid
, the user needs to reauthenticate. The user also needs to reauthenticate if you receive a 401
response instead.
Account Management Endpoint Poll Requests
Make poll requests to Account Management endpoints and check sync_state
. The user needs to reauthenticate if the value is invalid-credentials
.
Webhooks
Subscribe to Webhooks with the account.*
triggers to stay up to date with account status changes. If you receive account.invalid
, the user needs to reauthenticate.
Best Practices
We recommend building out support for Webhooks and either Account or Account Management endpoint poll requests within your system to stay up to date around account sync_state
updates.