How do I re-authenticate an account?

You received webhook: account.stopped or account.invalid. The /a/client_id/accounts/id endpoint returns a sync_stateof:

  • invalid-credentials
  • stopped

See: https://developer.nylas.com/docs/the-basics/manage-accounts/account-sync-status/#account-management 

Resolution:

From the Dashboard:

  • Go to any account from the dashboard that you would like to re-authenticate. You will see a Generate a new token button. By clicking this button, you will re-authenticate your account and get the new Access Code after the successful authentication. Make sure to save the Access Code somewhere for calling the API later.

 


Hosted Authentication via API (used by 80% of the apps)

  • Call /oauth/authorize endpoint direct for getting a redirect URL for authentication. Then following the process to get a code back. Using the code in the payload to call /oauth/token endpoint for exchanging a new Access Code for calling the API later.

Native Authentication via API (less common)

 

Re-Auth:

Best Practice Account Re-Authentication 

  1. Start by authenticating the account 
  2. Then using attribute keep_access_token call /revoke-all endpoint ensuring to only keep the most recent token (keep_access_token). This will ensure that you are using the correct token.
  3. If using scheduler ensure you update the token by visiting https://api.schedule.nylas.com/manage/pages with the newly generated token. For more info see our documentation.

Note: We DO NOT recommend calling downgrade/upgrade or revoke-all without the attribute keep_access_token with re-auth. This can cause unknown issues with re-auth. 

 

 

 

Updated

Was this article helpful?

1 out of 1 found this helpful

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.