Sign-in with Google, GitHub, WeChat and SSO
Since v1.40 the admin and site member accounts (SaaS kit and other plugins) can sign in with an external account: fewer sign-ups, and an easy way into a company's existing identity provider. E-mail + password sign-in always stays, and so do password reset and two-factor sign-in.
Settings: Admin → System → Sign-in methods (/admin/sign-in, admins only).
Services
| Service | Notes | Extra settings |
|---|---|---|
| OpenID Connect, PKCE | — | |
| GitHub | OAuth App, verified primary e-mail only | — |
| Microsoft (Entra ID / personal) | OpenID Connect, PKCE | Tenant: common (any account) or your tenant id |
| GitLab | gitlab.com or self-managed, PKCE | GitLab URL |
| Discord, Facebook, LinkedIn | — | — |
| WeChat Open Platform "website application" (QR code) | authorised callback domain = your domain | |
| QQ Connect | — | |
| DingTalk | DingTalk open platform app | — |
| Feishu / Lark | Feishu open platform app | Edition: feishu or lark |
| Gitee | Gitee OAuth app | — |
| OpenID Connect (custom) | any OIDC service: Okta, Auth0, Keycloak, Authing, Logto, Casdoor, Azure AD B2C ... | Issuer URL (/.well-known/openid-configuration is read) |
| OAuth 2.0 (custom) | in-house systems with plain OAuth 2 | authorize / token / user info URLs, id / e-mail / name / avatar fields (paths like data.user.id) |
Custom services may be added several times, ids custom-xxx (16 characters at most).
Setup
- Admin → Sign-in methods → "Add sign-in method", choose the service;
- copy the card's callback URL (
https://your-domain/api/oauth/<id>/callback) into the provider's developer console; every purpose (admin, SaaS accounts) shares this one URL; - enter the client id / secret the console gives you;
- tick Admin sign-in and / or Site member sign-in; save.
Secrets are encrypted with a key derived from NUXT_JWT_SECRET, never sent back (blank = keep)
and left out of site backups. After changing the JWT secret, enter them again.
Keys may also come from the environment (leave the admin fields blank):
NUXT_OAUTH_GOOGLE_CLIENT_ID / NUXT_OAUTH_GOOGLE_CLIENT_SECRET, with GITHUB, MICROSOFT,
GITLAB, DISCORD, FACEBOOK, LINKEDIN, WECHAT, QQ, DINGTALK, FEISHU or GITEE in place
of GOOGLE. Until the admin saves a choice, such a service is on for site members only, not for
the admin.
Admin sign-in rules
Providers never create admins on their own. An external account gets into the admin when:
- it is connected: the admin connected it under Account security → "Sign-in providers" (recommended);
- link by e-mail (on by default): the provider verified an address that an admin account
uses; the first sign-in connects them. Microsoft multi-tenant (
common) apps, WeChat, QQ, DingTalk, Feishu and custom OAuth 2 servers give no trusted address and never match; - create for domains (off by default): verified addresses of the listed domains (e.g.
example.com) get an admin account on their first sign-in, as editor, author or contributor (never admin).
Accounts with two-factor sign-in still enter their code. Every sign-in is listed under devices and
in the audit log (method oauth:<service>); connections can be removed on the account page.
Failures return to the sign-in page with the reason ("not connected to an admin account" ...).
Site members (SaaS accounts)
Services ticked for "Site member sign-in" appear on the SaaS sign-in page (/account/login). Keys
entered in the SaaS settings keep working with their older callback URL
/api/saas/oauth/<service>/callback: nothing to change at the providers.
For plugin and site developers
- buttons:
<CmsOAuthButtons purpose="admin" separator />(purposemay be a plugin's, e.g.saas); - account page card:
<AdminAccountIdentities />; - a plugin registers its own purpose in a Nitro plugin:
export default defineNitroPlugin(() => {
defineOAuthPurpose('shop', {
audience: 'site', // services ticked for site members
async complete(event, profile, ctx) {
// profile: { provider, id, email, emailVerified, name, avatar }
// sign in or create the member, set its cookie, return the path to go to
return `/${ctx.locale}/member`
},
failure: (event, code, ctx) => `/${ctx.locale}/member/login?error=${code}`,
})
})
Start URL: /api/oauth/<service>?for=shop&locale=us&redirect=/us/member.
nuxtcms doctor reports site copies of admin/login.vue, admin/account.vue and
admin/verify.vue that lack the new parts.
Database
New table user_identities (migration 0023_user_identities). D1 sites: wrangler d1 migrations apply after the upgrade, or run the migration SQL directly (IF NOT EXISTS, safe to repeat).
Until then provider sign-ins fail and the account page asks for the migration; e-mail + password
sign-in is unaffected.