providers/wikimedia
维基媒体个人资料
扩展
Record
<string
,any
>
属性
已阻止
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,
}),
],
})
资源
配置步骤
- 转到并接受消费者注册文档:https://meta.wikimedia.org/wiki/Special:OAuthConsumerRegistration
- 请求新的 OAuth 2.0 消费者以获取
clientId
和clientSecret
:https://meta.wikimedia.org/wiki/Special:OAuthConsumerRegistration/propose/oauth2- 将以下重定向 URL 添加到控制台中:
http://<your-next-app-url>/api/auth/callback/wikimedia
- 不要选中此消费者仅用于您用户名旁边的复选框。
- 除非您明确需要更大的范围,否则请随意选择标记为用户身份验证,没有读取页面或代表用户执行操作的能力的单选按钮。
- 将以下重定向 URL 添加到控制台中:
注册后,您最初只能使用自己的维基媒体帐户测试您的应用程序。您可能需要等待几天才能批准应用程序,以便每个人都能使用它。
备注
此提供商还支持所有维基媒体项目。
- 维基百科
- 维基数据
- 维基教科书
- 维基词典
- 等等。
请注意,维基媒体帐户不需要关联电子邮件地址。因此,您可能需要在允许用户登录之前检查用户是否有电子邮件地址。
默认情况下,Auth.js 假设维基媒体提供商基于 OAuth 2 规范。
💡
维基媒体提供商附带了 默认配置。要覆盖您的用例的默认值,请查看 自定义内置 OAuth 提供商。
类型参数
类型参数 |
---|
P extends 维基媒体个人资料 |
参数
参数 | 类型 |
---|---|
选项 | OAuthUserConfig <P > |
返回值
OAuthConfig
<P
>