Wikimedia-based sign-in
Let users sign in with an existing Wikimedia account without implementing OAuth endpoints manually.
Auth.js · Const
Auth.js includes a built-in Wikimedia OAuth provider. Configure its client credentials, register the framework-specific callback URL, and add Wikimedia to the Auth.js providers list.
Wikimedia is a built-in OAuth provider for Auth.js. Import its provider definition, add it to the providers array, set the required environment variables, and register the matching callback URL with Wikimedia.
WikimediaAUTH_WIKIMEDIA_ID and AUTH_WIKIMEDIA_SECRET./api/auth/callback/wikimedia path.import NextAuth from "next-auth"
import Wikimedia from "next-auth/providers/wikimedia"
export const { handlers, auth, signIn, signOut } = NextAuth({
providers: [Wikimedia],
})Register the built-in Wikimedia provider in the Auth.js configuration, then use its exported handlers and authentication helpers.
Let users sign in with an existing Wikimedia account without implementing OAuth endpoints manually.
Authenticate users across Wikimedia sites such as Wikipedia and Wikidata.
Request identity verification only when the application needs login but no page access or user actions.
Import the built-in Wikimedia provider and include it in Auth.js's providers array. The page's Next.js example uses Wikimedia directly rather than passing custom OAuth endpoints.
Follow-up: How does the callback route get determined? Auth.js uses the provider identifier in the callback path, so the Next.js callback is /api/auth/callback/wikimedia.
Set AUTH_WIKIMEDIA_ID and AUTH_WIKIMEDIA_SECRET, then register the corresponding callback URL with Wikimedia. For Next.js, the documented callback format is https://example.com/api/auth/callback/wikimedia.
Follow-up: What must change for another Auth.js integration? Use that framework's callback format; the page shows non-Next.js examples without the /api segment.
Wikimedia supports multiple projects, including Wikipedia, Wikidata, Wikibooks, and Wiktionary. The provider therefore represents Wikimedia OAuth access across those projects rather than only one site.
Follow-up: What permission choice is appropriate for sign-in only? Select the identity-verification-only scope unless page reading or user actions are required.
OAuth providersConfiguring an OAuth providerAuth.js providers