I am working on integrating Gmail using the Nylas API for an app that automates email follow-ups. I have followed the docs on setting up OAuth but keep hitting a redirect_uri_mismatch error when trying to authorize accounts.
Here’s what I have done so far:
Created a Google Cloud project and set up OAuth 2.0 credentials
Using the Nylas SDK for Node.js
Still, the OAuth flow fails right after the user grants permission. I suspect I might be missing a step in Google’s consent screen config or redirect handling.
For your Google Cloud application to work with Nylas, you need to add the correct Authorized Redirect URI in your Google Cloud project. The specific URI depends on your data residency:
Update Google Cloud Console: Go to your Google Cloud Platform dashboard, select Credentials, then update the Authorized redirect URIs to include the correct Nylas callback URL above (Create a Google auth app | Docs).
Verify Your Node.js Configuration: Make sure your Nylas SDK setup matches this pattern (Using the Node.js SDK | Docs):
javascript
import Nylas from "nylas";
const nylas = new Nylas({ apiKey: "<NYLAS_API_KEY>", apiUri: "<NYLAS_API_URI>"});