@swr-login/plugin-oauth-wechat
v0.2.4
Published
WeChat OAuth login plugin for swr-login (QR code scan & H5 web authorization)
Maintainers
Readme
@swr-login/plugin-oauth-wechat
WeChat OAuth login plugin for swr-login (QR code scan & H5 web authorization).
Install
npm install @swr-login/plugin-oauth-wechatUsage
import { WeChatOAuthPlugin } from '@swr-login/plugin-oauth-wechat';
const plugin = WeChatOAuthPlugin({
appId: 'your-wechat-app-id',
redirectUri: 'https://yourapp.com/callback/wechat',
// 'qrcode' (default) | 'h5'
mode: 'qrcode',
});Then use the useLogin hook:
const { login, isLoading } = useLogin('wechat');
<button onClick={() => login()}>微信登录</button>Features
- 📱 QR code scan login (PC web)
- 🌐 H5 web authorization (mobile browser)
- 🔒 CSRF state parameter validation
- ⚡ Zero page refresh on login
Part of swr-login
See the full project at github.com/tobytovi/swr-login.
