Modify Authorized redirect_uris For Google OAuth
Jun 3, 2022
To log in with Google OAuth in Node.js, you should use the googleapis npm package.
The OAuth redirect URI is the 3rd param to google.auth.OAuth2
as shown below.
const { google } = require('googleapis');
const oauth2Client = new google.auth.OAuth2(
process.env.GOOGLE_CLIENT_ID,
process.env.GOOGLE_CLIENT_SECRET,
process.env.GOOGLE_OAUTH_CALLBACK_URL
);
Google requires you to configure a list of allowed OAuth callback URLs (also called OAuth redirect URIs) in the Google Cloud Platform console.
To modify your app's allowed redirect URIs, go to console.cloud.google.com
, click the left side panel, and navigate to APIs & Services > Credentials
.
From there, find the OAuth credential that you want to modify. Click "Edit" and you should see a list of "Authorized redirect URIs".
Did you find this tutorial useful? Say thanks by starring our repo on GitHub!