Nylas Docs

The Nylas Developer Hub

Welcome to the Nylas developer hub. You'll find comprehensive guides and documentation to help you start working with Nylas as quickly as possible, as well as support if you get stuck. Let's jump right in!

Developer Guide

Handling account re-authentications

When a user’s credentials or server settings (for IMAP/ SMTP or Exchange) changes, the account will stop syncing and its status will change to ‘invalid-credentials’. For the account sync to resume, you must ask the user to go through the authentication flow again with their new credentials or server settings.

For a simple credentials change, once the user has re-authenticated, account sync simply resumes.

For a server settings change – for example, if the user changes the IMAP/ SMTP or Exchange server endpoint – all previously synced Nylas API IDs for the account will be invalidated. The user will be associated with a new account and account_id, and the Nylas API token returned from re-authentication will point to this account.

Your application must detect this new account_id and take appropriate measures to invalidate all existing IDs you have cached since they are no longer valid.

Please be sure to revoke any old access tokens you are no longer using with the /oauth/revoke endpoint. If you no longer have access to old access tokens, you can revoke all tokens automatically using the Revoke all tokens endpoint.

Warning

A password change usually doesn't create a separate account, but it’s possible that Nylas will autodetect a different mail server during re-authentication. It’s important to be aware of any account_id changes for a particular user.

From an application perspective on your end, if you ever detect that the account_id changes for a user you need to "resync" since all your old object IDs won't be valid any longer.

Handling account re-authentications


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.