Hyperse
  • Pricing
  • FAQs
Newsletter

Subscribe to our newsletter

Receive weekly updates with latest collections and exclusive offers, straight to your inbox.

Hyperse

Headless commerce solutions for brands, developers, and modern ecommerce teams.

Explore

  • Home
  • About Us
  • Partners
  • FAQs

Legal & resources

  • Proposal
  • Privacy Policy
  • Terms & Conditions

© 2026 Hyperse. All rights reserved.


  1. Home
  2. Vendure Plugins
  3. hps-plugin-auth-google
hps-plugin-auth-google

hps-plugin-auth-google

By Hyperse

hps-plugin-auth-google is a Auth Google plugin in the Hub Auth group.hps-plugin-auth-google provides Auth Google plugin capabilities for Hub Auth. Authentication, identity, and account access integrations. It is especially useful for auth workflows.

CoreVendure Plugins

Specifications

Technical details and package information for this product.

Package

@hyperse-hub/hps-plugin-auth-google

Support by

Hyperse

Support languages

TypeScript, JavaScript, Prolog, Shell, CSS

Integration type

Core

Category

Vendure Plugins

Compatible with

^3.0.0

Latest version

1.1.3

Downloads

0

Repository

ssh://git@github.com/hyperse-hub/hub-auth

Last published

July 02, 2026

Description
Changelog
loading...

@hyperse-hub/hps-plugin-auth-google

Google OAuth authentication for Vendure Shop API.

Features

  • Google OAuth sign-in / sign-up: uses Vendure authenticate + google strategy (creates a Customer/User if not exists)
  • Avatar sync: downloads Google picture as a Vendure Asset and stores it in Customer.customFields.avatar
  • Cross-strategy email conflict protection (optional): prevents the same email being used across different auth strategies
  • Set native password: provides Shop GraphQL setGooglePassword(email, password) to add a native auth method after Google login

Install

yarn add @hyperse-hub/hps-plugin-auth-google

Vendure configuration

Register the plugin in vendure-config.ts and configure Google OAuth credentials:

Options

  • googleClientId: Google OAuth Client ID
  • googleClientSecret: Client secret
  • redirectUri: OAuth redirect URI (used when exchanging the authorization code for tokens)
  • preventCrossStrategies: enforce unique email across all Shop auth strategies (default false)
    • If enabled, the login will be rejected when the Google email is already used by another strategy

Note: the strategy is only added to config.authOptions.shopAuthenticationStrategy when googleClientId is non-empty.

Google provider setup (OAuth client)

Create an OAuth 2.0 Client in Google Cloud Console and configure:

  • Authorized redirect URIs: must include the configured redirectUri
  • Scopes: recommend at least openid email profile

The plugin exchanges the authorization code for tokens and verifies the id_token (not the access token).

Shop API usage

1) Obtain the Google code in your frontend

Let your frontend complete the Google OAuth flow and receive the authorization code.

2) Call Vendure authenticate (strategy: google)

Send the code to Vendure authenticate (this is the input shape used in this repo's e2e tests):

Note: the input type is defined by the strategy defineInputType() (GoogleAuthInput: code).

3) (Optional) Set a native password: setGooglePassword

After the user signs in with Google (must be authenticated), you can call:

  • This mutation requires authentication (Permission.Authenticated)
  • It adds a native authentication method to the current user, enabling email+password login
  • email must match the current user's identifier, otherwise it throws Unauthorized

Data model change: Customer.customFields.avatar

The plugin ensures Customer.customFields.avatar exists (relation to Asset) on bootstrap:

  • Field name: avatar
  • Type: relation -> Asset
  • Readonly: readonly: true

When a user is created via Google for the first time, the plugin tries to download the avatar and store it in this field.

FAQ

What is redirectUri and why must it match exactly?

When exchanging the authorization code, Google validates redirect_uri. It must exactly match the Authorized redirect URIs in Google Console and the plugin redirectUri.

What does preventCrossStrategies check?

It checks whether the Google-provided email is already associated with a user via any other Shop auth strategy. If so, it rejects the Google login to avoid one email being used across multiple strategies.

On this page

  • @hyperse-hub/hps-plugin-auth-google
    • Features
    • Install
    • Vendure configuration
      • Options
    • Google provider setup (OAuth client)
    • Shop API usage
      • 1) Obtain the Google code in your frontend
      • 2) Call Vendure authenticate (strategy: google)
      • 3) (Optional) Set a native password: setGooglePassword
    • Data model change: Customer.customFields.avatar
    • FAQ
      • What is redirectUri and why must it match exactly?
      • What does preventCrossStrategies check?

import { HpsPluginAuthGoogle } from '@hyperse-hub/hps-plugin-auth-google';
export const config = {
// ...
plugins: [
HpsPluginAuthGoogle.init({
googleClientId: process.env.GOOGLE_CLIENT_ID ?? '',
googleClientSecret: process.env.GOOGLE_CLIENT_SECRET ?? '',
redirectUri: process.env.GOOGLE_REDIRECT_URI ?? '',
preventCrossStrategies: false,
}),
],
};
mutation AuthenticateWithGoogle($code: String!) {
authenticate(input: { google: { code: $code } }) {
... on CurrentUser {
identifier
}
... on InvalidCredentialsError {
errorCode
message
}
}
}
mutation SetGooglePassword($email: String!, $password: String!) {
setGooglePassword(email: $email, password: $password) {
id
identifier
}
}