fullauth / DOCS / Providers / google
GitHub

DOCUMENTATION / PROVIDERS

Google OAuth provider

The source includes a built-in GoogleProvider for the Next.js handler. It requests the openid email profile scopes, exchanges the callback code with Google, and reads the user profile from Google’s userinfo endpoint.

Configure the provider

Create OAuth client credentials with Google and store the client secret and FullAuth secret on the server. Keep the public backend origin in NEXT_PUBLIC_FULLAUTH_URL; the provider appends its callback path to that origin.

app/api/auth/[...fullauth]/route.ts

import type { AuthOptions } from '@fullauth/core';
import { GoogleProvider } from '@fullauth/core/providers';
import { NextHandler } from '@fullauth/next';

export const authOptions: AuthOptions = {
  secret: process.env.FULLAUTH_SECRET!,
  providers: [
    GoogleProvider({
      clientId: process.env.GOOGLE_CLIENT_ID!,
      clientSecret: process.env.GOOGLE_CLIENT_SECRET!,
    }),
  ],
};

const handler = NextHandler(authOptions);
export { handler as GET, handler as POST };

Register callback URLs

Register the exact callback URL that matches your backend origin. The source builds these paths:

  • Web: ${NEXT_PUBLIC_FULLAUTH_URL}/api/auth/callback/google
  • Mobile callback path in the provider source: ${NEXT_PUBLIC_FULLAUTH_URL}/api/auth/callback/mobile/google

See Google’s OAuth documentation and register the callback URL in the Google Cloud OAuth client configuration.

Verification limits

  • The repository contains a Google provider module; this audit did not run a live OAuth flow with registered Google credentials.
  • The React Native helper does not open or complete the OAuth redirect response returned by the server. The presence of a mobile callback path does not establish working Google sign-in in a React Native app.
  • In the current source, OAuth state carries the requested redirect URL and the callback decodes it. The callback does not compare it with a generated, stored one-time value. Have this flow reviewed before using Google sign-in with live users.
  • No built-in GitHub, Facebook, Apple, or Microsoft provider module is present. The generic provider types do not mean those integrations are included.

Use the credentials guide for the application-provided credentials verifier.