The complete source of the following example plugin can be found here: example-plugins/github-auth-plugin
GitHub OAuth authentication allows customers to sign in using their GitHub accounts, eliminating the need for password-based registration.
This is particularly valuable for developer-focused stores or B2B marketplaces.
This guide shows you how to add GitHub OAuth support to your Vendure store using a custom AuthenticationStrategy.
First, use the Vendure CLI to create a new plugin for GitHub authentication:
This creates a basic plugin structure with the necessary files.
Now create the GitHub authentication strategy. This handles the OAuth flow and creates customer accounts using GitHub profile data:
The strategy uses Vendure's ExternalAuthenticationService to handle customer creation.
It uses the GitHub account's primary email address and only marks the account as verified when GitHub reports that email as verified, and stores the GitHub username as the external identifier for future logins.
Now update the generated plugin file to register your authentication strategy:
Add the plugin to your Vendure configuration:
Before you can test the integration, you need to create a GitHub OAuth App:
http://localhost:3001 (your storefront URL)http://localhost:3001/auth/github/callbackThe localhost URLs shown here are for local development only. In production, replace localhost:3001 with your actual domain (e.g., https://mystore.com).
Add these credentials to your environment:
In your storefront, create a function to generate the GitHub authorization URL:
Create a callback handler to process the GitHub response and authenticate with Vendure:
The OAuth flow follows these steps:
Once your plugin is running, the GitHub authentication will be available in your shop API:
GitHub-authenticated customers are managed like any other Vendure Customer:
verified flag on the primary email — only verified emails mark the account as verifiedThis means GitHub users work seamlessly with Vendure's order management, promotions, and customer workflows.
To test your GitHub OAuth integration: