指南
社交登录教程
使用 @capgo/capacitor-social-login
所有社交登录功能在一个插件中
安装
bun add @capgo/capacitor-social-login
bunx cap sync
此插件暴露的内容
initialize- 初始化插件login- 使用选定的提供商登录logout- 登出isLoggedIn- 是否已登录
示例使用
initialize
初始化插件。
import { SocialLogin } from '@capgo/capacitor-social-login';
await SocialLogin.initialize({} as InitializeOptions);
login
使用选定的提供商登录。
import { SocialLogin } from '@capgo/capacitor-social-login';
await SocialLogin.login({} as Extract<LoginOptions, { provider: T }>);
logout
注销。
import { SocialLogin } from '@capgo/capacitor-social-login';
await SocialLogin.logout({} as {
provider: 'apple' | 'google' | 'facebook' | 'twitter' | 'oauth2';
providerId?: string;
});
isLoggedIn
isLoggedIn。
import { SocialLogin } from '@capgo/capacitor-social-login';
await SocialLogin.isLoggedIn({} as isLoggedInOptions);
全参考
- GitHub: https://github.com/Cap-go/capacitor-social-login/
- 文档:/docs/plugins/social-login/
继续使用@capgo/capacitor-social-login
如果您正在使用 使用@capgo/capacitor-social-login 来规划身份验证和帐户流程,连接它 @capgo/capacitor-social-login for the implementation detail in @capgo/capacitor-social-login, Getting Started __CAPGO_KEEP_0__入门 @capgo/capacitor-passkey for the implementation detail in @capgo/capacitor-passkey, @capgo/capacitor-native-biometric for the implementation detail in @capgo/capacitor-native-biometric, and Two-factor authentication __CAPGO_KEEP_0__双因素认证