Skip to content
Migrating from NextAuth.js v4? Read our migration guide.
Getting Started

Google Provider



Callback URL

Environment Variables



import NextAuth from "next-auth"
import Google from "next-auth/providers/google"
export const { handlers, auth, signIn, signOut } = NextAuth({
  providers: [Google],


Refresh Token

Google only provides Refresh Token to an application the first time a user signs in.

To force Google to re-issue a Refresh Token, the user needs to remove the application from their account and sign in again:

Alternatively, you can also pass options in the params object of authorization which will force the Refresh Token to always be provided on sign in, however this will ask all users to confirm if they wish to grant your application access every time they sign in.

If you need access to the RefreshToken or AccessToken for a Google account and you are not using a database to persist user accounts, this may be something you need to do.

export const { handlers, auth, signIn, signOut } = NextAuth({
  providers: [
      clientId: process.env.GOOGLE_ID,
      clientSecret: process.env.GOOGLE_SECRET,
      authorization: {
        params: {
          prompt: "consent",
          access_type: "offline",
          response_type: "code",

For more information on exchanging a code for an access token and refresh token see the Google OAuth documentation.

Email Verified

Google also returns a email_verified boolean property in the OAuth profile.

You can use this property to restrict access to people with verified accounts at a particular domain.

export const { handlers, auth, signIn, signOut } = NextAuth({
  callbacks: {
    async signIn({ account, profile }) {
      if (account.provider === "google") {
        return profile.email_verified &&"")
      return true // Do different verification for other providers that don't have `email_verified`
Auth.js © Balázs Orbán and Team - 2024