跳至内容
从 NextAuth.js v4 迁移?阅读 我们的迁移指南.

providers/wikimedia

内置 维基媒体 集成。

维基媒体个人资料

扩展

属性

已阻止

blocked: boolean;

已确认的电子邮件

confirmed_email: boolean;

编辑计数

editcount: number;

电子邮件

email: string;

授权

grants: WikimediaGrant[];

groups: WikimediaGroup[];

真实姓名

realname: string;

注册

registered: string;

权限

rights: WikimediaRight[];

sub: string;

用户名

username: string;

维基媒体授权

type WikimediaGrant: 
  | "basic"
  | "blockusers"
  | "checkuser"
  | "createaccount"
  | "delete"
  | "editinterface"
  | "editmycssjs"
  | "editmyoptions"
  | "editmywatchlist"
  | "editpage"
  | "editprotected"
  | "editsiteconfig"
  | "globalblock"
  | "highvolume"
  | "import"
  | "mergehistory"
  | "oath"
  | "oversight"
  | "patrol"
  | "privateinfo"
  | "protect"
  | "rollback"
  | "sendemail"
  | "shortenurls"
  | "uploadfile"
  | "viewdeleted"
  | "viewmywatchlist";

维基媒体组

type WikimediaGroup: 
  | "*"
  | "user"
  | "autoconfirmed"
  | "extendedconfirmed"
  | "bot"
  | "sysop"
  | "bureaucrat"
  | "steward"
  | "accountcreator"
  | "import"
  | "transwiki"
  | "ipblock-exempt"
  | "oversight"
  | "rollbacker"
  | "propertycreator"
  | "wikidata-staff"
  | "flood"
  | "translationadmin"
  | "confirmed"
  | "flow-bot"
  | "checkuser";

维基媒体权限

type WikimediaRight: 
  | "abusefilter-log"
  | "apihighlimits"
  | "applychangetags"
  | "autoconfirmed"
  | "autopatrol"
  | "autoreview"
  | "bigdelete"
  | "block"
  | "blockemail"
  | "bot"
  | "browsearchive"
  | "changetags"
  | "checkuser"
  | "checkuser-log"
  | "createaccount"
  | "createpage"
  | "createpagemainns"
  | "createtalk"
  | "delete"
  | "delete-redirect"
  | "deletedhistory"
  | "deletedtext"
  | "deletelogentry"
  | "deleterevision"
  | "edit"
  | "edit-legal"
  | "editinterface"
  | "editmyoptions"
  | "editmyusercss"
  | "editmyuserjs"
  | "editmyuserjson"
  | "editmywatchlist"
  | "editprotected"
  | "editsemiprotected"
  | "editsitecss"
  | "editsitejs"
  | "editsitejson"
  | "editusercss"
  | "edituserjs"
  | "edituserjson"
  | "globalblock"
  | "import"
  | "importupload"
  | "ipblock-exempt"
  | "item-merge"
  | "item-redirect"
  | "item-term"
  | "markbotedits"
  | "massmessage"
  | "mergehistory"
  | "minoredit"
  | "move"
  | "move-subpages"
  | "movefile"
  | "movestable"
  | "mwoauth-authonlyprivate"
  | "nominornewtalk"
  | "noratelimit"
  | "nuke"
  | "patrol"
  | "patrolmarks"
  | "property-create"
  | "property-term"
  | "protect"
  | "purge"
  | "read"
  | "reupload"
  | "reupload-own"
  | "reupload-shared"
  | "rollback"
  | "sendemail"
  | "skipcaptcha"
  | "suppressionlog"
  | "tboverride"
  | "templateeditor"
  | "torunblocked"
  | "transcode-reset"
  | "translate"
  | "undelete"
  | "unwatchedpages"
  | "upload"
  | "upload_by_url"
  | "viewmywatchlist"
  | "viewsuppressed"
  | "writeapi";

默认()

default<P>(options): OAuthConfig<P>

将维基媒体登录添加到您的页面。

设置

回调 URL

https://example.com/api/auth/callback/wikimedia

配置

import { Auth } from "@auth/core"
import Wikimedia from "@auth/core/providers/wikimedia"
 
const request = new Request(origin)
const response = await Auth(request, {
  providers: [
    Wikimedia({
      clientId: WIKIMEDIA_CLIENT_ID,
      clientSecret: WIKIMEDIA_CLIENT_SECRET,
    }),
  ],
})

资源

配置步骤

注册后,您最初只能使用自己的维基媒体帐户测试您的应用程序。您可能需要等待几天才能批准应用程序,以便每个人都能使用它。

备注

此提供商还支持所有维基媒体项目。

  • 维基百科
  • 维基数据
  • 维基教科书
  • 维基词典
  • 等等。

请注意,维基媒体帐户不需要关联电子邮件地址。因此,您可能需要在允许用户登录之前检查用户是否有电子邮件地址。

默认情况下,Auth.js 假设维基媒体提供商基于 OAuth 2 规范。

💡

维基媒体提供商附带了 默认配置。要覆盖您的用例的默认值,请查看 自定义内置 OAuth 提供商

免责声明如果您认为在默认配置中发现了一个错误,您可以 打开一个问题

Auth.js 严格遵守规范,它不对提供商的任何偏离规范的行为负责。您可以打开一个问题,但如果问题是非规范合规性,我们可能不会追求解决方案。您可以在 讨论 中寻求更多帮助。

类型参数

类型参数
P extends 维基媒体个人资料

参数

参数类型
选项OAuthUserConfig<P>

返回值

OAuthConfig<P>

Auth.js © Balázs Orbán 和团队 -2024