Back to feed
Dev.to
Dev.to
7/20/2026
Connect a mailbox with Nylas hosted OAuth

Connect a mailbox with Nylas hosted OAuth

Short summary

This tutorial walks through Nylas's hosted OAuth flow for connecting a user's mailbox to your application via Google, Microsoft, or other providers. The two-step process redirects users to a hosted authorization URL for consent, then exchanges the returned code at a token endpoint for a durable grant_id. The guide covers required and optional parameters including state for CSRF protection and access_type for refresh tokens, with both HTTP API and CLI examples.

  • Hosted OAuth delegates provider-specific auth to Nylas, returning a grant_id for API calls
  • Two-step flow: redirect for consent, then server-side code exchange for the grant
  • Set state parameter for CSRF protection and access_type=offline for refresh tokens

Generated with AI, which can make mistakes.

Is this a good recommendation for you?

Comments

Failed to load comments. Please try again.

Explore more