@next-auth-oauth/wechatmp
Version:
基于Auth.js的微信公众号验证码登录、二维码扫描登录插件
26 lines (25 loc) • 794 B
TypeScript
import type { OAuth2Config, OAuthUserConfig } from 'next-auth/providers';
import { type WechatMpLoginManagerConfig } from './WehcatMpLoginManger';
export * from './lib/CaptchaManager';
export type WechatMpProfile = {
/**
* 公众号扫码只能获得openid
*/
openid: string;
/**
*
*/
unionid: string;
};
type WechatMpResult = {
GET: (req: Request) => Promise<Response>;
POST: (req: Request) => Promise<Response>;
};
/**
* 微信公众号平台(验证码登录)
* [体验账号申请](https://mp.weixin.qq.com/debug/cgi-bin/sandbox?t=sandbox/login)
*
* @param options
* @returns
*/
export default function WeChatMp<P extends WechatMpProfile>(options: OAuthUserConfig<P> & Partial<WechatMpLoginManagerConfig>): OAuth2Config<P> & WechatMpResult;