How Strapi social login works for end users, and where it differs from admin SSO
If your team is building a Strapi front end that needs visitors to sign in with Google or GitHub, you are working with end-user authentication, which runs through the Users & Permissions plugin. Admin SSO is a separate feature that only covers administrator login to the admin panel through an identity provider, so it does not decide how your site's visitors sign in. Keep the two decisions apart in your plan: the admin panel's sign-in settings and the public login flow have different owners, different configuration screens and different risks.
At a high level, the integration works as a provider-based method inside Users & Permissions. You enable a Google or GitHub provider, register an OAuth application with each provider, and give Strapi the client credentials and callback addresses the provider expects. When a visitor signs in, Strapi creates or matches a user record and issues its own session token to your front end, which then decides where the visitor goes next. Your front end never needs to hold the provider's secret. The exact provider fields, the callback format and the way the token is returned change between versions, so confirm every setting against the Strapi 5 documentation for the version you have installed before you write any front-end code. The Strapi SSO documentation is the right reference for the admin side, and it is also the place to see what it does not cover.
Plan for the boundary early. Admin SSO settings such as default roles and local login lock-out do not change what a public visitor can do, and end-user providers do not grant anyone access to the admin panel. Decide now which role new social users receive, which content they can read or write, and whether your team needs a separate user population for editors. Confirm with your own Strapi version and plan whether the features you need are available, since SSO and advanced controls can be plan-dependent.
What you need before registering Google and GitHub apps
Social login touches your Strapi project, your database, your Node.js runtime, two external developer consoles and the public URLs your front end uses. Settle these inputs first, because the provider registrations and redirect settings depend on them and are hard to change once users start signing in.
Strapi 5 with Users & Permissions enabled
Confirm the project runs Strapi 5 and that the Users & Permissions plugin is active, since it issues the end-user accounts and JWTs that social providers feed into. Check that the users-permissions provider settings are reachable in your environment and that you know which content type holds end-user profiles. If the project is still on v4, plan the upgrade before adding providers, because the authentication endpoints and response shapes differ between versions.
A supported database
Use PostgreSQL 14 or later, MySQL 8.0 or later, MariaDB 10.3 or later or SQLite 3. Strapi 5 does not support MongoDB or other NoSQL databases. Social login creates new user rows and account links, so check that the database is backed up and that you can restore it before go-live. Confirm the version in the environment you will run in production, not only in development.
Installation requirementsA Node.js version on the LTS list
Strapi 5 runs only on Active or Maintenance LTS Node.js versions. Pin the version in your build image and in your hosting runtime so the front end, the Strapi server and the CI pipeline run the same release. Check the list at the time of build, because LTS status changes over a Node.js release's life.
Google Cloud project and OAuth client
Create or pick a Google Cloud project that your organization owns, then configure the OAuth consent screen and an OAuth client for a web application. Decide who owns the project, who can change the client secret, and whether the consent screen is internal to a Workspace domain or open to any Google account. Record the client ID and secret in your secrets store, not in the repository.
GitHub OAuth app
Register an OAuth app in the GitHub account or organization that will own it. Choose an owner that will remain with the company, because transferring or deleting the app breaks sign-in for every user. Note that GitHub returns the email address only when the user grants that scope, so confirm how your front end handles accounts without a public email.
Public URLs over HTTPS and approvers
Fix the public front-end and API URLs over HTTPS before registering either provider, because each registration needs exact callback and origin values. Name the owner accounts that must approve the registrations and the callback URLs each provider expects for your installed version, and confirm those values with the vendor documentation and your own test environment before you rely on them.
How the social login round trip moves between browser, front end, Strapi and the provider
The round trip starts when a visitor selects Google or GitHub in the front end, which sends the browser to Strapi's provider route and then to the provider's authorization server. The provider returns the browser to the Strapi callback, where Strapi exchanges the code for profile details, finds or creates the Users & Permissions account, and issues its own JWT. Strapi then redirects the browser back to the front end. The trust boundary sits between the browser and the Strapi back end, so check that the token only travels through the redirect you designed and that the front end stores it deliberately.
Sequence of a Google or GitHub login, showing where Strapi issues the JWT and where the front end keeps it.
Configuring Google and GitHub providers in Strapi step by step
This sequence connects Google and GitHub to the Users & Permissions plugin so end users can sign in from your front end. The result is a working provider on each side, a Strapi user record created from the first successful login, and a front end that handles both success and cancelled sign-in.
Register the Google OAuth client
In the Google Cloud console, create OAuth client credentials for a web application. Add the authorized redirect URI that Strapi's Google provider callback expects for your Strapi base URL, matching the scheme, host and path exactly. Copy the client ID and client secret for the next step. Confirm the current console screens and the callback path in the Strapi providers documentation for your version, since Google changes its console layout. The step is done when the client lists the exact redirect URI you intend to use.
Register the GitHub OAuth app
In GitHub developer settings, create a new OAuth app. Set the homepage URL to your front end and set the authorization callback URL to the GitHub callback path that Strapi's provider documentation specifies for your Strapi base URL. Generate a client secret and copy it with the client ID. Check the callback URL character by character, because a mismatch between the registered value and the URL Strapi sends produces an error at the consent screen. The step is done when the app shows the callback URL you intend to use and both credentials are stored securely.
Enter provider credentials in Users & Permissions
In the Strapi admin panel, open the Users & Permissions plugin settings and go to the providers section. Enable Google and GitHub, paste each client ID and secret, and save. Where your deployment supports environment variables for secrets, keep the values out of the admin UI and confirm with your Strapi configuration documentation how they are loaded. The step is done when both providers show as enabled, the save completes without validation errors, and the provider status persists after a reload or a restart.
Allow the front-end redirect URL
In the Users & Permissions provider settings, add the exact front-end URL that Strapi may send users back to after sign-in. Include the path of the callback page your front end uses to read the returned token or session, and list each environment separately, such as a staging and a production front end. Keep the list short. The step is done when a sign-in attempt that names an unlisted redirect URL is refused by Strapi, while the listed URL completes the flow.
Enable provider routes for the public role
Open Users & Permissions roles and edit the Public role. Enable the connect and callback routes for Google and GitHub, along with any other authentication routes your front end calls before a user is signed in. Save the role. The step is done when an anonymous request to each provider's connect route starts the provider's consent screen, instead of returning a forbidden response. If it fails, check the role permissions first, then the provider configuration from the previous step.
Test each provider from a clean session
Open a private browser window or clear cookies and local storage, then start sign-in from the front end's button for Google. Complete consent and confirm that the browser returns to your front-end callback page without an error, with the session or token available to the app. In the Strapi admin panel, check the Users collection for a new record with the provider recorded and a generated username. Repeat for GitHub, then cancel the consent screen once for each provider to confirm the front end handles the error page. The step is done when both providers create user records and the cancel path returns the user to a usable state.
Choosing generated usernames and account linking rules
Google and GitHub do not guarantee that every account returns a usable handle. GitHub users may have no public name, and Google profiles often carry a display name that is not unique or suitable as a username. Strapi's Users & Permissions model expects a username on every user record, so your sign-in flow must create one when the provider does not supply it. Decide the pattern before build, because it becomes part of every account record and is hard to change later.
- Source field: Choose whether the generated name starts from the GitHub login, the Google email local part or the display name, and document the fallback order.
- Uniqueness: Add a numeric or random suffix and check the database for collisions inside the same transaction that creates the user.
- Character rules: Normalize case and strip characters your front end or support tools cannot handle well.
- Privacy: Avoid putting full names or email addresses into public usernames, since the username may appear in content and URLs.
- Support lookup: Store the provider and provider user ID alongside the username so support staff can find the account without relying on the handle.
Confirm with your Strapi version and provider configuration how the provider profile fields reach your custom code before you finalize the pattern.
Some teams let users replace the generated username after first sign-in. This improves how accounts look in the product, but it adds a step that can fail, and it changes what support staff see when they search. The decision depends on whether usernames are shown publicly, whether they appear in URLs, and whether other systems rely on them as a stable identifier.
- Prompt timing: Decide whether the choice appears on first sign-in, in a profile page later, or only when a feature needs it.
- Availability checks: Plan a uniqueness check that runs before save and a clear message when a name is taken.
- Change policy: Decide whether users may change usernames repeatedly and whether old names are released or reserved.
- Stable identifier: Keep the Strapi user ID or provider ID as the key for integrations, so a username change does not break linked records.
- Moderation: Define who handles reserved or offensive names and how that is logged.
Check how your front end routes and caches profile data before you allow changes, since stale usernames can persist in links and cached pages.
When a user who already has an email and password account signs in with Google or GitHub, your application must decide whether to link the identities, create a second account or refuse the sign-in. The answer depends mainly on whether the provider verifies email and whether your Strapi users table permits duplicate email addresses. Linking on an unverified email lets an attacker who controls a provider account take over an existing account, so this rule needs the most review.
- Verified email only: Link automatically only when the provider reports a verified email, and treat unverified or missing emails as a separate path.
- Duplicate emails: Confirm whether your Users & Permissions configuration and custom code allow two users with the same email. Most teams prevent this.
- Explicit confirmation: Require the user to sign in with the existing password, or confirm by email, before linking.
- Support trail: Log each link event with provider, timestamp and the account it joined, so support can explain later changes.
- Unlinking: Decide whether users can remove a linked provider and what happens to sessions when they do.
Review the rule with your security team and write the decision down, including the cases you refuse, before any code is written.
How provider profile fields map to Strapi user fields
This table compares the profile values Google and GitHub return with the Strapi Users & Permissions fields they would fill, the rule to apply when a value is missing, and who owns each value. Read it as a starting design for your mapping, then confirm every provider field name against the current Google and GitHub documentation and your installed Strapi version before coding.
| Profile value | Strapi user field | When missing | Who owns the value |
|---|---|---|---|
| Subject identifier (Google sub, GitHub numeric id) | Provider account key, stored with provider name | Reject sign-in; this value must always exist | Identity provider |
| Verified email address | email, with confirmed set to true only when the provider marks it verified | Do not auto-link or confirm; ask the user for a verified address | User, asserted by the provider |
| Email verification status | confirmed flag | Leave unconfirmed and block account linking by email | Identity provider |
| Display name | Custom display name attribute, not username | Leave empty and let the editor or user supply one | User |
| Login handle (GitHub login) | Seed for generated username | Generate from email prefix plus random suffix | User, changeable in Strapi |
| Avatar URL | Optional custom media or URL attribute | Skip; do not fail sign-in | User, may change at provider |
| Provider name (google or github) | provider field on the user record | Always set by the provider flow, never from client input | Strapi configuration |
| Organization or domain membership (Google Workspace hd claim, where present) | Custom attribute used for access checks | Treat as unknown and grant no extra role | Google, confirm claim availability |
Redirect handling in the front end after provider sign-in
The front end must treat the Strapi callback as the end of the server-side exchange and then take over the user's session. Confirm the token delivery method for your Strapi version before you write any front-end code. Depending on how your Users & Permissions setup and your Strapi version return results, the front end may receive a JWT in a query parameter, read a value set by the server, or call an endpoint to fetch the user after the redirect. Each method has different implications for where the token is stored, how it is cleared and whether it can leak through browser history, logs or referrer headers. Write down which method your team uses, which route handles the return, and which component reads the result, so that the server-rendered and single-page targets are built against the same contract.
Return URLs are the main redirect risk. If the front end sends users back to whatever address arrives in a redirect or returnTo parameter, an attacker can craft a sign-in link that lands a user on a lookalike site after authentication. Keep an allowlist of permitted return paths or origins, compare parsed URLs instead of string prefixes, and fall back to a fixed page when the value is missing or fails the check. Store the intended destination in the server session or a signed, short-lived value tied to the sign-in attempt rather than trusting a value that the browser can rewrite. Test this with malformed, encoded and protocol-relative values, since these are the inputs that most often bypass naive checks.
Error paths need the same care as the success path. When a user denies consent on Google or GitHub, or the provider returns an error, the callback should route to a sign-in page that explains the outcome without exposing provider error details or internal identifiers. Handle a missing or expired state value, an account that cannot be linked and a failed user lookup as separate cases. For server-rendered front ends, implement these checks in the route handler and set cookies with the appropriate attributes on the server. For single-page front ends, the router and state store must handle the same cases, and the team must confirm that the app does not keep a partial session after a failed return. Plan retests of denial, cancellation and tampered-parameter cases before go-live.
Security settings that decide whether social login is safe to ship
Social login adds an external identity source to a public front end, and every control below narrows what a successful sign-in can reach. Review them together before launch, because a loose redirect, an exposed secret or an open public role can undo the protection the identity provider gives you.
Keep client secrets server-side
The Google or GitHub client secret must live in the Strapi server environment or a managed secrets store, never in a front-end bundle, environment variable prefixed for the browser, or repository history. Only the public client identifier belongs in front-end code. Check the built JavaScript and the deployed environment for the secret after each release, and rotate it if it has ever been committed or logged.
Pin redirect and callback URLs
Register each callback URL exactly, including scheme, host, port and path, in both the provider console and the Users & Permissions provider settings. Avoid wildcards and open redirect parameters that send users to an address you do not control after sign-in. Test with a mismatched host and a path with extra segments to confirm the flow fails closed.
Verify email before linking accounts
Linking a social identity to an existing local account by matching email address lets anyone who controls a provider account with that address take over the local user. Link only when the provider reports the email as verified, and ask for a re-authentication or confirmation step when a local account already exists. Document the rule so the team does not relax it later.
Limit the authenticated role
Newly created social users receive the Authenticated role, so its permissions define what a signed-in user can read and write. Grant only the content types and actions that the front end needs, and keep write access to profile fields explicit. Test by calling each endpoint with a fresh social account and confirm that no private content or admin-only fields are returned.
Review public permissions and auth rate limits
The Public role must not gain access just because sign-in exists. Check the callback and provider routes, the local login and registration routes, and any custom auth controllers for rate limiting at your proxy or gateway. Confirm that failed attempts and enumeration responses do not reveal whether an email address already has an account.
Log sign-in events
Record provider, outcome, user identifier, timestamp and source address for each sign-in, failed callback and account link, and keep those logs outside the content database. Strapi's own audit logs are an Enterprise feature, so confirm whether your plan covers these events or whether you need application-level logging. Define who reviews the logs and how long they are kept.
Why Google or GitHub sign-in fails after the redirect
This table lists the failures teams most often hit after the provider redirects users back to the front end, with the cause and the specific check that confirms each fix. Read it as a checklist to run during testing before users reach the login flow. The main takeaway is that most failures trace to a small set of mismatched values: callback URLs, environment variables, allowlisted return URLs, and the email and cookie settings that connect the provider to Strapi.
| Failure | Likely cause | Fix and check to run |
|---|---|---|
| Redirect URI mismatch | The callback URL registered at Google or GitHub differs from the URL Strapi sends, often by protocol, host, port, or trailing path. | Compare the callback URL in the provider console with the value built from your Strapi server URL, character for character, in each environment. |
| Client secret in the wrong environment | A production secret was copied into staging, or a local .env value overrides the deployed one, so the token exchange is rejected. | Print the client ID and confirm which secret the running container reads. Use separate OAuth apps per environment and check the deployed config, not your laptop. |
| Return URL not on the allowlist | The front-end URL the user returns to is missing from Strapi's allowed redirect settings, so Strapi refuses the handoff. | List every front-end origin and path used after login, including preview and localhost. Test each one and confirm the exact string is in the configured allowlist. |
| Duplicate accounts from unverified email | The integration links or creates a user by email without checking that the provider marks the address as verified, so a second account appears. | Confirm the provider profile says the email is verified before linking. Test sign-in with an existing email/password account and check the user count afterward. |
| Missing email from GitHub | The user keeps their email private, so the profile returns no address and user creation fails or sends an empty identifier. | Request the user email scope and fetch the primary verified email from the emails endpoint. Test with a GitHub account that hides its email. |
| CORS or cookie failure between origins | The front end and API run on different origins, so the browser blocks the response or drops a cookie that was not set with the right SameSite and Secure attributes. | Check the browser network log for CORS errors, confirm the allowed origin in Strapi's CORS settings, and verify cookie attributes match whether the front end and API share a site. |
| Token lost on page reload | The JWT is held only in memory or in state that resets on reload, so the session disappears after the first refresh. | Confirm where the token is stored after the callback and reload the page on a protected route. Ask whether your design needs refresh handling, as covered in the token session topic. |
What social login with Strapi costs and what the work needs from your team
What drives the effort of adding Google or GitHub login to Strapi?
The effort is driven by the rules you set, more than by the code. Each provider needs its own OAuth app, callback URLs for every environment, and a server-side exchange that turns the provider's response into a Users & Permissions user and a Strapi JWT. The main multipliers are the number of providers, how you generate usernames for accounts that have no username, how you link a social sign-in to an account that already exists by email, and the front-end framework that handles the redirect and session. A larger existing user base makes linking and data checks take longer, because mistakes touch real accounts.
- Number of providers and their consoles
- Account linking and email verification rules
- Front-end framework and session handling
- Size and state of the existing user base
Can our team add social login to Strapi without a partner?
Yes, a team with Strapi and OAuth experience can add a single provider with clear rules without outside help. The work becomes harder when you add a second provider, link accounts across providers, migrate existing users, or need an audit trail of who signed in how. Check whether your engineers have built Users & Permissions customizations before, because the linking logic lives in server code that must be tested against edge cases such as an unverified email address or a changed email at the provider. Confirm the current provider options and setup steps against the Strapi documentation for your version, since the Users & Permissions configuration is separate from the admin SSO feature.
What does the work need from our team before it starts?
Your team needs to provide access and decisions before any build begins. Plan for these inputs:
- Administrator access to the Google Cloud and GitHub consoles, or a named owner who will create the OAuth apps and share the client settings securely
- A decision owner for account linking rules, username format and which email domains are accepted
- Test accounts for each provider in every environment, including accounts with unverified or shared email addresses
- A staging environment that matches production's domain and HTTPS setup, so callback URLs can be tested before launch
How long does social login take to build, and what sets the schedule?
No duration is fixed here. The schedule depends on how quickly decisions are made, how soon console access and test accounts are available, and how many environments need callback testing. Linking rules and username generation usually take the most discussion, and they should be settled in writing before code starts. A fixed-scope engagement sets the timeline in the agreed plan, so ask for the milestones and the sign-off points each one needs from your side.
Does social login for end users need a paid Strapi plan?
Admin SSO and end-user login are different features, so check them separately. In Strapi's self-hosted plans, SSO for administrators is an add-on on the Growth plan and is included in Enterprise. End-user authentication is handled by the Users & Permissions plugin, which is not described as an SSO add-on in the Strapi SSO documentation. Confirm on the self-hosted pricing page whether your chosen plan includes the features you need before you commit to a plan or a quote.
What should a fixed-scope quote for social login itemize?
Ask for a quote that lists each deliverable and the responsibility for each. Useful line items include:
- Requirements and linking rules, signed off in writing
- OAuth app setup per provider and per environment
- Server changes to the Users & Permissions flow, including username generation and linking
- Front-end redirect handling and session behavior
- Test cases for new, returning, linked and rejected accounts
- Handover notes and a rollback plan
For each item, ask who does the work, what the client supplies, and what is excluded, such as later providers or user data migration.
What goes wrong with social login and how do we check for it?
The most common failures involve account linking. If the code trusts an email address that the provider has not verified, a user can take over another person's account. Other frequent problems are callback URLs that differ between staging and production, usernames that collide, and redirect loops after sign-in. Before launch, test each provider with a new user, a returning user, a user whose email matches an existing account, and an unverified email. Review the linking code with someone who did not write it, and confirm that the JWT and session lifetime match your policy.
Does DeployOpen handle the Strapi and provider work end to end?
DeployOpen plans, implements and tests self-hosted open-source platforms inside your own infrastructure, including Strapi integrations and identity setup. Work is usually fixed-scope, with scope, deliverables and timelines agreed in writing before work starts, and the quote follows from that written scope. DeployOpen does not publish prices, so ask for a quote based on your provider count, linking rules and environments. Ongoing support and retesting are available as retainers.
How DeployOpen scopes, builds and supports Strapi social login
DeployOpen plans Google and GitHub sign-in for end users of your Strapi front end as a fixed-scope engagement, with the Users & Permissions configuration, username handling, account linking and redirect behavior agreed in writing first. The work is built and tested in infrastructure you control, then handed over with documentation your team can run and change.
How we scope
- Confirm which providers apply, Google, GitHub or both, and which front-end framework calls Strapi
- Agree in writing how generated usernames are formed and how existing email accounts are linked
- Record the redirect URLs, allowed origins and post-login destinations for each environment before build starts
How we build
- Configure the Google and GitHub providers in Users & Permissions with client credentials held in your secrets store
- Implement the username generation and account linking rules agreed during scoping, with test accounts for each path
- Wire the front-end callback handling and test sign-in, failed sign-in and sign-out flows across staging environments
How we hand over
- Deliver a configuration record listing provider settings, callback URLs, roles and environment-specific values
- Document the account linking decisions and the steps to add a provider or change a redirect later
- Walk your engineers through the test cases and the checks to run after any Strapi or provider upgrade
How we support
- Engagements are fixed-scope, and changes outside the written scope are quoted separately
- Ongoing support, provider credential rotation and upgrade checks are available as a retainer
- Confirm with your team which retest cadence and monitoring you need once the sign-in flows are in production

