You received webhook: account.stopped or account.invalid. The /a/client_id/accounts/id
endpoint returns a sync_state
of:
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 acode
back. Using thecode
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)
- Call
/connect/authorize
endpoint with the credentials to get acode
back. Using thecode
in the payload to call/connect/token
endpoint for exchanging a new Access Code for calling the API later.
Re-Auth:
Best Practice Account Re-Authentication
- Start by authenticating the account
- 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.
- 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
Comments
0 comments
Please sign in to leave a comment.