Skip to content

Authenticating with Nylas

Nylas uses OAuth 2.0 to create grants — authenticated connections that give your application access to a user’s email, calendar, and contacts data. Every API call that reads or writes user data requires a grant_id.

Most applications should use Hosted OAuth with API key. Nylas handles token refresh after the initial exchange, so you only ever use your API key and the user’s grant_id.

MethodBest forToken managementRequires redirect UI?Supported providers
Hosted OAuth (API key)Most server-side integrationsNylas managesYesGoogle, Microsoft, Yahoo, iCloud
Hosted OAuth (access token + PKCE)SPAs and mobile appsYou manage refreshYesGoogle, Microsoft
Bring your own authenticationTeams with an existing OAuth flowYou manage entirelyNoGoogle, Microsoft
IMAPLegacy or self-hosted email serversApp passwordsNoAny IMAP server
Service accountServer-to-server, no user interactionNylas managesNoGoogle Workspace

Before setting up authentication, you need:

  1. Log in to the Nylas Dashboard and create a Nylas application.
  2. Get your application’s API key.
  3. Create auth apps for the providers you plan to integrate with.
  4. Create connectors for your provider auth apps. Nylas supports Google, Microsoft, IMAP, Exchange on-premises, iCloud, Yahoo, and Zoom Meetings.
  5. Add your project’s callback URIs to your Nylas application.
  6. Authenticate your users and create grants for them.

If you plan to connect Google or Microsoft accounts, you need a provider auth app. You can use it with internal accounts right away for development and testing — the provider review only matters before you go live.

We recommend maintaining separate provider auth apps per environment so you can adjust scopes and settings in development without affecting production users. The review process can take several weeks, so plan this into your timeline.

Request only the most restrictive scopes you need. If you request any of Google’s restricted scopes, Google requires a full security assessment — this can significantly extend your verification timeline.

See the Google verification and security assessment guide for details.

You can’t create connectors or change scopes on a Nylas Sandbox application. Sandbox applications include a limited set of pre-configured connectors for testing.

Connectors store your provider app credentials so you don’t need to include them in every API call. You can’t create grants without at least one connector.

Create connectors from the Nylas Dashboard under Connectors, or with the Create Connector API endpoint.

Each connector supports multiple credentials, letting you use different provider auth apps with a single connector. You can also set default scopes per connector and override them when creating individual grants.

For bulk setup and multi-app configurations, see Bulk authentication grants and Using multiple provider applications.

Add callback URIs to your Nylas application

Section titled “Add callback URIs to your Nylas application”

Callback URIs are where Nylas redirects users after they complete authentication.

  1. Log in to the Nylas Dashboard.
  2. On your application’s page, click Hosted Authentication > Callback URIs in the left navigation.
  3. Click Add a callback URI.
  4. Select the platform and enter a URL.
  5. Click Add callback URI.

Customize Hosted Authentication branding: add your logo to the login page, set up a custom domain (CNAME) for your authentication flow, and more.

Grants can expire when users change passwords, revoke access, or when provider tokens are invalidated. Expired grants are recoverable through re-authentication, which preserves the grant ID, object IDs, and sync state. See Handling expired grants for best practices on detection and recovery.