Google Auth Module Provider

In this guide, you’ll learn about the Google Auth Module Provider and how to install and use it in the Auth Module.

The Google Auth Module Provider allows you to authenticate users with their Google account.

Environment Variables#

Make sure to add the necessary environment variables for the above options in .env:

Code
GOOGLE_CLIENT_ID=<YOUR_GOOGLE_CLIENT_ID>
GOOGLE_CLIENT_SECRET=<YOUR_GOOGLE_CLIENT_SECRET>
GOOGLE_CALLBACK_URL=<YOUR_GOOGLE_CALLBACK_URL>

Module Options#

Configuration

Description

Required

clientId

A string indicating the Google API Client ID.

Yes

clientSecret

A string indicating the Google Client Secret.

Yes

callbackUrl

A string indicating the URL to redirect to in your frontend after the user completes their authentication in Google.

At this URL, the frontend will receive a code query parameter. It then sends that code query parameter to the MedusaGo application's /auth/{actor_type}/google/callback route.

Yes


Override Callback URL During Authentication#

In many cases, you may have different callback URLs for actor types. For example, you may redirect admin users to a different URL than customers after authentication.

The Authenticate or Login API Route can accept a callback_url body parameter to override the provider's callbackUrl option. Learn more in this documentation.


Examples#

Found a problem with this page?Report Issue
Edited Nov 14·Edit this page