POST
/v3/connect/tokenHosted OAuth - Token exchange
The standard OAuth token endpoint for Hosted Authentication. This endpoint doesn't require authentication, as it is part of the auth process.
You can pass one of the following grant_type values:
authorization_code: Exchange thecodeNylas returns from the OAuth 2.0 authorization flow for tokens (access_tokenandrefresh_token). -refresh_token: Use the existingrefresh_tokenfor an existing grant to issue a newaccess_token. You must pass your API key in theclient_secretfield.client_credentials: Issue a new short-lived (1 hour)access_tokenusing an existinggrant_id. You must pass your API key in theclient_secretfield. This is mainly used in Scheduler implementations.
This endpoint accepts both application/json and application/x-www-form-urlencoded request body types. The body parameters are the same for both, with the same naming conventions.
For more information, see the Hosted authentication with access token documentation.
Failed token exchange requests
Each OAuth code is a unique, one-time-use credential. If your token exchange fails, you must restart the OAuth process. If you try to pass the original code in another token exchange request, the provider rejects the code and Nylas returns an error.