概览
概览部分所有社交登录插件
视频教程
视频教程部分观看插件设置和登录流程的快速演示。
核心功能
标题:核心功能initialize- 初始化插件。login- 使用所选提供商登录。logout- 登出。isLoggedIn- 是否已登录。
公共 API
标题:公共 API| 方法 | 描述 |
|---|---|
initialize | 初始化插件。 |
login | 使用选定的提供者登录。 |
logout | 注销。 |
isLoggedIn | 是否已登录。 |
getAuthorizationCode | 获取当前授权 code。 |
refresh | 刷新访问令牌。 |
refreshToken | OAuth2 刷新令牌助手(与 Capawesome OAuth 具有相同的特性)。 |
handleRedirectCallback | 仅 Web:处理 OAuth 重定向回调并返回解析结果。 |
decodeIdToken | 解码 JWT(通常为 OIDC ID 令牌)以获取其声明。 |
getAccessTokenExpirationDate | 将访问令牌过期时间戳(以毫秒为单位的 Unix 时间戳)转换为 ISO 日期字符串。 |
isAccessTokenAvailable | 检查是否有可用的访问令牌(非空)。 |
isAccessTokenExpired | 检查是否有过期的访问令牌。 |
isRefreshTokenAvailable | 检查是否有可用的刷新令牌(非空)。 |
providerSpecificCall | 执行提供商特定的调用。 |
getPluginVersion | 获取本机 Capacitor 插件版本。 |
openSecureWindow | Opens a secured window for OAuth2 authentication. For web, you should have the code in the redirected page to use a broadcast channel to send the redirected url to the app Something like: html <html> <head></head> <body> <script> const searchParams = new URLSearchParams(location.search) if (searchParams.has("code")) { new BroadcastChannel("my-channel-name").postMessage(location.href); window.close(); } </script> </body> </html> 对于 web,应该在重定向页面中包含 __CAPGO_KEEP_0__,以使用广播通道将重定向 URL 发送到应用程序。例如: myapp://oauth_callback/ 对于移动设备,应该有一个重定向 URI,打开应用程序,例如: xml <key>CFBundleURLTypes</key> <array> <dict> <key>CFBundleURLSchemes</key> <array> <string>myapp</string> </array> </dict> </array> 并且确保在应用程序的 info.plist 中注册它: xml <activity> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:host="oauth_callback" android:scheme="myapp" /> </intent-filter> </activity> . |
并且在 AndroidManifest.xml 文件中注册它:
真实来源标题为“真实来源”的部分 src/definitions.ts 此参考是从 capacitor-social-login.
继续从 @capgo/capacitor-social-login 中
继续从 @capgo/capacitor-social-login 中的标题如果您正在使用 @capgo/capacitor-social-login 来规划身份验证和帐户流程,连接它到 使用 @capgo/capacitor-social-login 为本机能力在使用 @capgo/capacitor-social-login 中 @capgo/capacitor-passkey 为 @capgo/capacitor-passkey 的实现细节 @capgo/capacitor-native-biometric 为 @capgo/capacitor-native-biometric 的实现细节 两因素身份验证 关于两步验证的实现细节, 和 企业SSO (单点登录) 的实现细节 企业SSO (单点登录)