Only show these results:
public-beta-v3

Creating Grants with Custom authentication

The Nylas API v3 is in public beta. It might contain bugs, and might change before it is generally available. See the v3 Beta documentation for more information.

Nylas v3 preserves Native authentication ("Bring your own token") almost unchanged, but renames it to "Custom authentication". If you already have a refresh token (or credentials, if using IMAP) for your end users from your own authentication implementation, you can use it with the Nylas APIs to create a Grant and get the grant_id, which you then use in requests to the provider.

If you used Native auth in Nylas 2.x, the only changes are to the Nylas API URLs, the requirement that you create an integration object for your application, and the change from token to bearer-token.

If you are handling the OAuth flow in your own application or want to migrate existing users, Custom authentication allows you to simply provide the user refresh_token to create a Grant.

Custom authentication example request

The following examples include a POST /v3/connect/custom request, and an example response.

{
"provider": "microsoft",
"settings": {
"refresh_token": "1//06lIzwlbg4SgLCgY..."
}
}
{
"request_id": "5967ca40-a2d8-4ee0-a0e0-6f18ace39a90",
"data": {
"id": "e19f8e1a-eb1c-41c0-b6a6-d2e59daf7f47",
"provider": "microsoft",
"grant_status": "valid",
"email": "[email protected]",
"scope": [
"Mail.Read",
"User.Read",
"offline_access"
],
"user_agent": "string",
"ip": "string",
"state": "my-state",
"created_at": 1617817109,
"updated_at": 1617817109
}
}

What's Next?

Now that you have created a Connector and received a Grant, you can:

  • Manage your [Connectors (previously called "integrations")](/docs/api/v3-beta/admin/#tag--Connectors-(Integrations)
  • Manage your Grants
  • Review the Event codes