@capgo/capacitor-social-login
All social logins in one plugin.
Overview
Section titled “Overview”All social logins in one plugin.
Core Capabilities
Section titled “Core Capabilities”initialize- Initialize the plugin.login- Login with the selected provider.logout- Logout.isLoggedIn- IsLoggedIn.
Public API
Section titled “Public API”| Method | Description |
|---|---|
initialize | Initialize the plugin. |
login | Login with the selected provider. |
logout | Logout. |
isLoggedIn | IsLoggedIn. |
getAuthorizationCode | Get the current authorization code. |
refresh | Refresh the access token. |
refreshToken | OAuth2 refresh-token helper (feature parity with Capawesome OAuth). |
handleRedirectCallback | Web-only: handle the OAuth redirect callback and return the parsed result. |
decodeIdToken | Decode a JWT (typically an OIDC ID token) into its claims. |
getAccessTokenExpirationDate | Convert an access token expiration timestamp (milliseconds since epoch) to an ISO date string. |
isAccessTokenAvailable | Check if an access token is available (non-empty). |
isAccessTokenExpired | Check if an access token is expired. |
isRefreshTokenAvailable | Check if a refresh token is available (non-empty). |
providerSpecificCall | Execute provider-specific calls. |
getPluginVersion | Get the native Capacitor plugin version. |
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> For mobile, you should have a redirect uri that opens the app, something like: myapp://oauth_callback/ And make sure to register it in the app’s info.plist: xml <key>CFBundleURLTypes</key> <array> <dict> <key>CFBundleURLSchemes</key> <array> <string>myapp</string> </array> </dict> </array> And in the AndroidManifest.xml file: 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> . |
Source Of Truth
Section titled “Source Of Truth”This reference is synced from src/definitions.ts in capacitor-social-login.