@capgo/capacitor-social-login 8.5.3 → 8.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +118 -24
- package/android/src/main/java/ee/forgr/capacitor/social/login/SocialLoginPlugin.java +1 -1
- package/dist/docs.json +160 -12
- package/dist/esm/auth-connect.js +2 -2
- package/dist/esm/auth-connect.js.map +1 -1
- package/dist/esm/definitions.d.ts +71 -10
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/linkedin-provider.d.ts +17 -0
- package/dist/esm/linkedin-provider.js +54 -0
- package/dist/esm/linkedin-provider.js.map +1 -0
- package/dist/esm/social-login.d.ts +4 -8
- package/dist/esm/social-login.js +50 -3
- package/dist/esm/social-login.js.map +1 -1
- package/dist/esm/web.d.ts +3 -8
- package/dist/esm/web.js +36 -4
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +174 -44
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +3180 -3050
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/SocialLoginPlugin/SocialLoginPlugin.swift +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,6 +20,7 @@ This plugin implements social auth for:
|
|
|
20
20
|
- Facebook (with latest SDK)
|
|
21
21
|
- Twitter/X (OAuth 2.0)
|
|
22
22
|
- Telegram (Login Widget)
|
|
23
|
+
- LinkedIn (OAuth 2.0 / OpenID Connect)
|
|
23
24
|
- Generic OAuth2 (supports multiple providers: GitHub, Azure AD, Auth0, Okta, and any OAuth2-compliant server)
|
|
24
25
|
|
|
25
26
|
This plugin is the all-in-one solution for social authentication on Web, iOS, and Android.
|
|
@@ -585,6 +586,35 @@ const res = await SocialLogin.login({
|
|
|
585
586
|
console.log(res.result.profile.id, res.result.hash);
|
|
586
587
|
```
|
|
587
588
|
|
|
589
|
+
## LinkedIn
|
|
590
|
+
|
|
591
|
+
LinkedIn is a convenience wrapper around the generic OAuth2 engine (OpenID Connect `userinfo`).
|
|
592
|
+
|
|
593
|
+
Register a web app in the [LinkedIn Developer Portal](https://www.linkedin.com/developers/apps) with the **Sign In with LinkedIn using OpenID Connect** product, then:
|
|
594
|
+
|
|
595
|
+
```typescript
|
|
596
|
+
await SocialLogin.initialize({
|
|
597
|
+
linkedin: {
|
|
598
|
+
clientId: 'your-linkedin-client-id',
|
|
599
|
+
redirectUrl: 'https://your-app.example/auth/linkedin',
|
|
600
|
+
// Optional: only if your LinkedIn app is a confidential client
|
|
601
|
+
// clientSecret: 'your-linkedin-client-secret',
|
|
602
|
+
},
|
|
603
|
+
});
|
|
604
|
+
|
|
605
|
+
const res = await SocialLogin.login({
|
|
606
|
+
provider: 'linkedin',
|
|
607
|
+
options: {
|
|
608
|
+
// defaults to 'openid profile email'
|
|
609
|
+
},
|
|
610
|
+
});
|
|
611
|
+
|
|
612
|
+
console.log(res.result.accessToken?.token);
|
|
613
|
+
console.log(res.result.resourceData); // LinkedIn userinfo payload
|
|
614
|
+
```
|
|
615
|
+
|
|
616
|
+
You can still configure LinkedIn yourself via `oauth2.linkedin` if you need custom endpoints.
|
|
617
|
+
|
|
588
618
|
## OAuth2 (Generic)
|
|
589
619
|
|
|
590
620
|
The plugin supports generic OAuth2 authentication, allowing you to integrate with any OAuth2-compliant provider (GitHub, Azure AD, Auth0, Okta, Keycloak, custom servers, etc.). You can configure multiple OAuth2 providers simultaneously.
|
|
@@ -905,14 +935,14 @@ Initialize the plugin
|
|
|
905
935
|
### login(...)
|
|
906
936
|
|
|
907
937
|
```typescript
|
|
908
|
-
login<T extends "apple" | "google" | "facebook" | "twitter" | "oauth2" | "telegram">(options: Extract<LoginOptions, { provider: T; }>) => Promise<{ provider: T; result: ProviderResponseMap[T]; }>
|
|
938
|
+
login<T extends "apple" | "google" | "facebook" | "twitter" | "linkedin" | "oauth2" | "telegram">(options: Extract<LoginOptions, { provider: T; }>) => Promise<{ provider: T; result: ProviderResponseMap[T]; }>
|
|
909
939
|
```
|
|
910
940
|
|
|
911
941
|
Login with the selected provider
|
|
912
942
|
|
|
913
|
-
| Param | Type
|
|
914
|
-
| ------------- |
|
|
915
|
-
| **`options`** | <code><a href="#extract">Extract</a><{ provider: 'facebook'; options: <a href="#facebookloginoptions">FacebookLoginOptions</a>; }, { provider: T; }> \| <a href="#extract">Extract</a><{ provider: 'google'; options: <a href="#googleloginoptions">GoogleLoginOptions</a>; }, { provider: T; }> \| <a href="#extract">Extract</a><{ provider: 'apple'; options: <a href="#appleprovideroptions">AppleProviderOptions</a>; }, { provider: T; }> \| <a href="#extract">Extract</a><{ provider: 'twitter'; options: <a href="#twitterloginoptions">TwitterLoginOptions</a>; }, { provider: T; }> \| <a href="#extract">Extract</a><{ provider: 'telegram'; options: <a href="#telegramloginoptions">TelegramLoginOptions</a>; }, { provider: T; }> \| <a href="#extract">Extract</a><{ provider: 'oauth2'; options: <a href="#oauth2loginoptions">OAuth2LoginOptions</a>; }, { provider: T; }></code> |
|
|
943
|
+
| Param | Type |
|
|
944
|
+
| ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
945
|
+
| **`options`** | <code><a href="#extract">Extract</a><{ provider: 'facebook'; options: <a href="#facebookloginoptions">FacebookLoginOptions</a>; }, { provider: T; }> \| <a href="#extract">Extract</a><{ provider: 'google'; options: <a href="#googleloginoptions">GoogleLoginOptions</a>; }, { provider: T; }> \| <a href="#extract">Extract</a><{ provider: 'apple'; options: <a href="#appleprovideroptions">AppleProviderOptions</a>; }, { provider: T; }> \| <a href="#extract">Extract</a><{ provider: 'twitter'; options: <a href="#twitterloginoptions">TwitterLoginOptions</a>; }, { provider: T; }> \| <a href="#extract">Extract</a><{ provider: 'telegram'; options: <a href="#telegramloginoptions">TelegramLoginOptions</a>; }, { provider: T; }> \| <a href="#extract">Extract</a><{ provider: 'linkedin'; options: <a href="#linkedinloginoptions">LinkedInLoginOptions</a>; }, { provider: T; }> \| <a href="#extract">Extract</a><{ provider: 'oauth2'; options: <a href="#oauth2loginoptions">OAuth2LoginOptions</a>; }, { provider: T; }></code> |
|
|
916
946
|
|
|
917
947
|
**Returns:** <code>Promise<{ provider: T; result: ProviderResponseMap[T]; }></code>
|
|
918
948
|
|
|
@@ -922,14 +952,14 @@ Login with the selected provider
|
|
|
922
952
|
### logout(...)
|
|
923
953
|
|
|
924
954
|
```typescript
|
|
925
|
-
logout(options: { provider: 'apple' | 'google' | 'facebook' | 'twitter' | 'telegram' | 'oauth2'; providerId?: string; }) => Promise<void>
|
|
955
|
+
logout(options: { provider: 'apple' | 'google' | 'facebook' | 'twitter' | 'telegram' | 'linkedin' | 'oauth2'; providerId?: string; }) => Promise<void>
|
|
926
956
|
```
|
|
927
957
|
|
|
928
958
|
Logout
|
|
929
959
|
|
|
930
|
-
| Param | Type
|
|
931
|
-
| ------------- |
|
|
932
|
-
| **`options`** | <code>{ provider: 'apple' \| 'google' \| 'facebook' \| 'twitter' \| 'oauth2' \| 'telegram'; providerId?: string; }</code> |
|
|
960
|
+
| Param | Type |
|
|
961
|
+
| ------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
|
|
962
|
+
| **`options`** | <code>{ provider: 'apple' \| 'google' \| 'facebook' \| 'twitter' \| 'linkedin' \| 'oauth2' \| 'telegram'; providerId?: string; }</code> |
|
|
933
963
|
|
|
934
964
|
--------------------
|
|
935
965
|
|
|
@@ -986,13 +1016,13 @@ Refresh the access token
|
|
|
986
1016
|
### refreshToken(...)
|
|
987
1017
|
|
|
988
1018
|
```typescript
|
|
989
|
-
refreshToken(options:
|
|
1019
|
+
refreshToken(options: RefreshTokenOptions) => Promise<OAuth2LoginResponse>
|
|
990
1020
|
```
|
|
991
1021
|
|
|
992
1022
|
OAuth2 refresh-token helper (feature parity with Capawesome OAuth).
|
|
993
1023
|
|
|
994
1024
|
Scope:
|
|
995
|
-
-
|
|
1025
|
+
- Applies to the built-in `oauth2` provider and the LinkedIn convenience wrapper.
|
|
996
1026
|
- Requires a token endpoint (either `accessTokenEndpoint`/`tokenEndpoint` or `issuerUrl` discovery).
|
|
997
1027
|
|
|
998
1028
|
Security note:
|
|
@@ -1000,9 +1030,9 @@ Security note:
|
|
|
1000
1030
|
|
|
1001
1031
|
If `refreshToken` is omitted, the plugin will attempt to use the stored refresh token (if available).
|
|
1002
1032
|
|
|
1003
|
-
| Param | Type
|
|
1004
|
-
| ------------- |
|
|
1005
|
-
| **`options`** | <code
|
|
1033
|
+
| Param | Type |
|
|
1034
|
+
| ------------- | ------------------------------------------------------------------- |
|
|
1035
|
+
| **`options`** | <code><a href="#refreshtokenoptions">RefreshTokenOptions</a></code> |
|
|
1006
1036
|
|
|
1007
1037
|
**Returns:** <code>Promise<<a href="#oauth2loginresponse">OAuth2LoginResponse</a>></code>
|
|
1008
1038
|
|
|
@@ -1020,6 +1050,8 @@ Web-only: handle the OAuth redirect callback and return the parsed result.
|
|
|
1020
1050
|
Notes:
|
|
1021
1051
|
- This is only meaningful on Web. iOS/Android implementations will reject.
|
|
1022
1052
|
- Intended for redirect-based flows (e.g. `oauth2` with `flow: 'redirect'`) where the page navigates away.
|
|
1053
|
+
- LinkedIn convenience logins (`provider: 'linkedin'`, `flow: 'redirect'`) return `provider: 'linkedin'`.
|
|
1054
|
+
The same app used as `oauth2` with `providerId: 'linkedin'` keeps `provider: 'oauth2'`.
|
|
1023
1055
|
|
|
1024
1056
|
**Returns:** <code>Promise<<a href="#loginresult">LoginResult</a> | null></code>
|
|
1025
1057
|
|
|
@@ -1229,6 +1261,7 @@ And in the AndroidManifest.xml file:
|
|
|
1229
1261
|
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
|
|
1230
1262
|
| **`oauth2`** | <code><a href="#record">Record</a><string, <a href="#oauth2providerconfig">OAuth2ProviderConfig</a>></code> | OAuth2 provider configurations. Supports multiple providers by using a <a href="#record">Record</a> with provider IDs as keys. |
|
|
1231
1263
|
| **`telegram`** | <code>{ botId: string; redirectUrl?: string; origin?: string; requestAccess?: 'read' \| 'write'; languageCode?: string; }</code> | Telegram Login Widget configuration. Uses Telegram's OAuth widget (`oauth.telegram.org`), not standard OAuth2. |
|
|
1264
|
+
| **`linkedin`** | <code><a href="#linkedinproviderconfig">LinkedInProviderConfig</a></code> | LinkedIn configuration. Convenience wrapper that maps to the OAuth2 provider using LinkedIn defaults. |
|
|
1232
1265
|
| **`twitter`** | <code>{ clientId: string; redirectUrl: string; defaultScopes?: string[]; forceLogin?: boolean; audience?: string; }</code> | |
|
|
1233
1266
|
| **`facebook`** | <code>{ appId: string; clientToken?: string; locale?: string; }</code> | |
|
|
1234
1267
|
| **`google`** | <code>{ iOSClientId?: string; iOSServerClientId?: string; webClientId?: string; mode?: 'online' \| 'offline'; hostedDomain?: string; redirectUrl?: string; }</code> | |
|
|
@@ -1270,6 +1303,23 @@ Configuration for a single OAuth2 provider instance
|
|
|
1270
1303
|
| **`logsEnabled`** | <code>boolean</code> | Enable debug logging | <code>false</code> |
|
|
1271
1304
|
|
|
1272
1305
|
|
|
1306
|
+
#### LinkedInProviderConfig
|
|
1307
|
+
|
|
1308
|
+
LinkedIn provider configuration (convenience wrapper around the generic OAuth2 provider).
|
|
1309
|
+
|
|
1310
|
+
Uses the OAuth2 engine with LinkedIn defaults:
|
|
1311
|
+
- Authorization URL: https://www.linkedin.com/oauth/v2/authorization
|
|
1312
|
+
- Token URL: https://www.linkedin.com/oauth/v2/accessToken
|
|
1313
|
+
- Resource URL: https://api.linkedin.com/v2/userinfo
|
|
1314
|
+
- Default scopes: `openid profile email`
|
|
1315
|
+
|
|
1316
|
+
| Prop | Type | Description |
|
|
1317
|
+
| ------------------ | ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1318
|
+
| **`clientId`** | <code>string</code> | LinkedIn Client ID from the LinkedIn Developer Portal. |
|
|
1319
|
+
| **`redirectUrl`** | <code>string</code> | Redirect URL that receives the OAuth callback. Must match a redirect URL configured in the LinkedIn Developer Portal. |
|
|
1320
|
+
| **`clientSecret`** | <code>string</code> | LinkedIn Client Secret. Prefer exchanging the authorization code on a backend when possible. Needed for confidential clients that do not use PKCE-only token exchange. |
|
|
1321
|
+
|
|
1322
|
+
|
|
1273
1323
|
#### FacebookLoginResponse
|
|
1274
1324
|
|
|
1275
1325
|
| Prop | Type | Description | Since |
|
|
@@ -1454,10 +1504,10 @@ Configuration for a single OAuth2 provider instance
|
|
|
1454
1504
|
|
|
1455
1505
|
#### isLoggedInOptions
|
|
1456
1506
|
|
|
1457
|
-
| Prop | Type
|
|
1458
|
-
| ---------------- |
|
|
1459
|
-
| **`provider`** | <code>'apple' \| 'google' \| 'facebook' \| 'twitter' \| 'oauth2' \| 'telegram'</code> | Provider |
|
|
1460
|
-
| **`providerId`** | <code>string</code>
|
|
1507
|
+
| Prop | Type | Description |
|
|
1508
|
+
| ---------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- |
|
|
1509
|
+
| **`provider`** | <code>'apple' \| 'google' \| 'facebook' \| 'twitter' \| 'linkedin' \| 'oauth2' \| 'telegram'</code> | Provider |
|
|
1510
|
+
| **`providerId`** | <code>string</code> | Provider ID for OAuth2 providers (required when provider is 'oauth2') |
|
|
1461
1511
|
|
|
1462
1512
|
|
|
1463
1513
|
#### AuthorizationCode
|
|
@@ -1470,10 +1520,10 @@ Configuration for a single OAuth2 provider instance
|
|
|
1470
1520
|
|
|
1471
1521
|
#### AuthorizationCodeOptions
|
|
1472
1522
|
|
|
1473
|
-
| Prop | Type
|
|
1474
|
-
| ---------------- |
|
|
1475
|
-
| **`provider`** | <code>'apple' \| 'google' \| 'facebook' \| 'twitter' \| 'oauth2'</code> | Provider |
|
|
1476
|
-
| **`providerId`** | <code>string</code>
|
|
1523
|
+
| Prop | Type | Description |
|
|
1524
|
+
| ---------------- | ------------------------------------------------------------------------------------- | --------------------------------------------------------------------- |
|
|
1525
|
+
| **`provider`** | <code>'apple' \| 'google' \| 'facebook' \| 'twitter' \| 'linkedin' \| 'oauth2'</code> | Provider |
|
|
1526
|
+
| **`providerId`** | <code>string</code> | Provider ID for OAuth2 providers (required when provider is 'oauth2') |
|
|
1477
1527
|
|
|
1478
1528
|
|
|
1479
1529
|
#### FacebookGetProfileResponse
|
|
@@ -1582,7 +1632,7 @@ Construct a type with a set of properties K of type T
|
|
|
1582
1632
|
|
|
1583
1633
|
#### ProviderResponseMap
|
|
1584
1634
|
|
|
1585
|
-
<code>{ facebook: <a href="#facebookloginresponse">FacebookLoginResponse</a>; google: <a href="#googleloginresponse">GoogleLoginResponse</a>; apple: <a href="#appleproviderresponse">AppleProviderResponse</a>; twitter: <a href="#twitterloginresponse">TwitterLoginResponse</a>; telegram: <a href="#telegramloginresponse">TelegramLoginResponse</a>; oauth2: <a href="#oauth2loginresponse">OAuth2LoginResponse</a>; }</code>
|
|
1635
|
+
<code>{ facebook: <a href="#facebookloginresponse">FacebookLoginResponse</a>; google: <a href="#googleloginresponse">GoogleLoginResponse</a>; apple: <a href="#appleproviderresponse">AppleProviderResponse</a>; twitter: <a href="#twitterloginresponse">TwitterLoginResponse</a>; telegram: <a href="#telegramloginresponse">TelegramLoginResponse</a>; linkedin: <a href="#linkedinloginresponse">LinkedInLoginResponse</a>; oauth2: <a href="#oauth2loginresponse">OAuth2LoginResponse</a>; }</code>
|
|
1586
1636
|
|
|
1587
1637
|
|
|
1588
1638
|
#### GoogleLoginResponse
|
|
@@ -1590,9 +1640,45 @@ Construct a type with a set of properties K of type T
|
|
|
1590
1640
|
<code><a href="#googleloginresponseonline">GoogleLoginResponseOnline</a> | <a href="#googleloginresponseoffline">GoogleLoginResponseOffline</a></code>
|
|
1591
1641
|
|
|
1592
1642
|
|
|
1643
|
+
#### LinkedInLoginResponse
|
|
1644
|
+
|
|
1645
|
+
LinkedIn login response (returned when using the LinkedIn convenience API).
|
|
1646
|
+
|
|
1647
|
+
<code><a href="#oauth2loginresponse">OAuth2LoginResponse</a></code>
|
|
1648
|
+
|
|
1649
|
+
|
|
1593
1650
|
#### LoginOptions
|
|
1594
1651
|
|
|
1595
|
-
<code>{ provider: 'facebook'; options: <a href="#facebookloginoptions">FacebookLoginOptions</a>; } | { provider: 'google'; options: <a href="#googleloginoptions">GoogleLoginOptions</a>; } | { provider: 'apple'; options: <a href="#appleprovideroptions">AppleProviderOptions</a>; } | { provider: 'twitter'; options: <a href="#twitterloginoptions">TwitterLoginOptions</a>; } | { provider: 'telegram'; options: <a href="#telegramloginoptions">TelegramLoginOptions</a>; } | { provider: 'oauth2'; options: <a href="#oauth2loginoptions">OAuth2LoginOptions</a>; }</code>
|
|
1652
|
+
<code>{ provider: 'facebook'; options: <a href="#facebookloginoptions">FacebookLoginOptions</a>; } | { provider: 'google'; options: <a href="#googleloginoptions">GoogleLoginOptions</a>; } | { provider: 'apple'; options: <a href="#appleprovideroptions">AppleProviderOptions</a>; } | { provider: 'twitter'; options: <a href="#twitterloginoptions">TwitterLoginOptions</a>; } | { provider: 'telegram'; options: <a href="#telegramloginoptions">TelegramLoginOptions</a>; } | { provider: 'linkedin'; options: <a href="#linkedinloginoptions">LinkedInLoginOptions</a>; } | { provider: 'oauth2'; options: <a href="#oauth2loginoptions">OAuth2LoginOptions</a>; }</code>
|
|
1653
|
+
|
|
1654
|
+
|
|
1655
|
+
#### LinkedInLoginOptions
|
|
1656
|
+
|
|
1657
|
+
LinkedIn login options (maps to the OAuth2 provider internally).
|
|
1658
|
+
`providerId` is set to `linkedin` automatically.
|
|
1659
|
+
|
|
1660
|
+
<code><a href="#omit">Omit</a><<a href="#oauth2loginoptions">OAuth2LoginOptions</a>, 'providerId'></code>
|
|
1661
|
+
|
|
1662
|
+
|
|
1663
|
+
#### Omit
|
|
1664
|
+
|
|
1665
|
+
Construct a type with the properties of T except for those in type K.
|
|
1666
|
+
|
|
1667
|
+
<code><a href="#pick">Pick</a><T, <a href="#exclude">Exclude</a><keyof T, K>></code>
|
|
1668
|
+
|
|
1669
|
+
|
|
1670
|
+
#### Pick
|
|
1671
|
+
|
|
1672
|
+
From T, pick a set of properties whose keys are in the union K
|
|
1673
|
+
|
|
1674
|
+
<code>{
|
|
1596
1675
|
[P in K]: T[P];
|
|
1597
1676
|
}</code>
|
|
1677
|
+
|
|
1678
|
+
|
|
1679
|
+
#### Exclude
|
|
1680
|
+
|
|
1681
|
+
<a href="#exclude">Exclude</a> from T those types that are assignable to U
|
|
1682
|
+
|
|
1683
|
+
<code>T extends U ? never : T</code>
|
|
1598
1684
|
|
|
1599
1685
|
|
|
1600
1686
|
#### Extract
|
|
@@ -1602,9 +1688,17 @@ Construct a type with a set of properties K of type T
|
|
|
1602
1688
|
<code>T extends U ? T : never</code>
|
|
1603
1689
|
|
|
1604
1690
|
|
|
1691
|
+
#### RefreshTokenOptions
|
|
1692
|
+
|
|
1693
|
+
Options for `refreshToken()`.
|
|
1694
|
+
`providerId` is required for generic `oauth2` and ignored for LinkedIn.
|
|
1695
|
+
|
|
1696
|
+
<code>{ provider: 'oauth2'; providerId: string; refreshToken?: string; additionalParameters?: <a href="#record">Record</a><string, string>; } | { provider: 'linkedin'; providerId?: string; refreshToken?: string; additionalParameters?: <a href="#record">Record</a><string, string>; }</code>
|
|
1697
|
+
|
|
1698
|
+
|
|
1605
1699
|
#### LoginResult
|
|
1606
1700
|
|
|
1607
|
-
<code>{ provider: 'facebook'; result: <a href="#facebookloginresponse">FacebookLoginResponse</a>; } | { provider: 'google'; result: <a href="#googleloginresponse">GoogleLoginResponse</a>; } | { provider: 'apple'; result: <a href="#appleproviderresponse">AppleProviderResponse</a>; } | { provider: 'twitter'; result: <a href="#twitterloginresponse">TwitterLoginResponse</a>; } | { provider: 'telegram'; result: <a href="#telegramloginresponse">TelegramLoginResponse</a>; } | { provider: 'oauth2'; result: <a href="#oauth2loginresponse">OAuth2LoginResponse</a>; }</code>
|
|
1701
|
+
<code>{ provider: 'facebook'; result: <a href="#facebookloginresponse">FacebookLoginResponse</a>; } | { provider: 'google'; result: <a href="#googleloginresponse">GoogleLoginResponse</a>; } | { provider: 'apple'; result: <a href="#appleproviderresponse">AppleProviderResponse</a>; } | { provider: 'twitter'; result: <a href="#twitterloginresponse">TwitterLoginResponse</a>; } | { provider: 'telegram'; result: <a href="#telegramloginresponse">TelegramLoginResponse</a>; } | { provider: 'linkedin'; result: <a href="#linkedinloginresponse">LinkedInLoginResponse</a>; } | { provider: 'oauth2'; result: <a href="#oauth2loginresponse">OAuth2LoginResponse</a>; }</code>
|
|
1608
1702
|
|
|
1609
1703
|
|
|
1610
1704
|
#### ProviderSpecificCallResponseMap
|
|
@@ -24,7 +24,7 @@ import org.json.JSONObject;
|
|
|
24
24
|
@CapacitorPlugin(name = "SocialLogin")
|
|
25
25
|
public class SocialLoginPlugin extends Plugin {
|
|
26
26
|
|
|
27
|
-
private final String pluginVersion = "8.5.
|
|
27
|
+
private final String pluginVersion = "8.5.4";
|
|
28
28
|
|
|
29
29
|
public static String LOG_TAG = "CapgoSocialLogin";
|
|
30
30
|
public HashMap<String, SocialProvider> socialProviderHashMap = new HashMap<>();
|
package/dist/docs.json
CHANGED
|
@@ -30,12 +30,12 @@
|
|
|
30
30
|
},
|
|
31
31
|
{
|
|
32
32
|
"name": "login",
|
|
33
|
-
"signature": "<T extends \"apple\" | \"google\" | \"facebook\" | \"twitter\" | \"oauth2\" | \"telegram\">(options: Extract<LoginOptions, { provider: T; }>) => Promise<{ provider: T; result: ProviderResponseMap[T]; }>",
|
|
33
|
+
"signature": "<T extends \"apple\" | \"google\" | \"facebook\" | \"twitter\" | \"linkedin\" | \"oauth2\" | \"telegram\">(options: Extract<LoginOptions, { provider: T; }>) => Promise<{ provider: T; result: ProviderResponseMap[T]; }>",
|
|
34
34
|
"parameters": [
|
|
35
35
|
{
|
|
36
36
|
"name": "options",
|
|
37
37
|
"docs": "",
|
|
38
|
-
"type": "Extract<{ provider: 'facebook'; options: FacebookLoginOptions; }, { provider: T; }> | Extract<{ provider: 'google'; options: GoogleLoginOptions; }, { provider: T; }> | Extract<{ provider: 'apple'; options: AppleProviderOptions; }, { provider: T; }> | Extract<{ provider: 'twitter'; options: TwitterLoginOptions; }, { provider: T; }> | Extract<{ provider: 'telegram'; options: TelegramLoginOptions; }, { provider: T; }> | Extract<{ provider: 'oauth2'; options: OAuth2LoginOptions; }, { provider: T; }>"
|
|
38
|
+
"type": "Extract<{ provider: 'facebook'; options: FacebookLoginOptions; }, { provider: T; }> | Extract<{ provider: 'google'; options: GoogleLoginOptions; }, { provider: T; }> | Extract<{ provider: 'apple'; options: AppleProviderOptions; }, { provider: T; }> | Extract<{ provider: 'twitter'; options: TwitterLoginOptions; }, { provider: T; }> | Extract<{ provider: 'telegram'; options: TelegramLoginOptions; }, { provider: T; }> | Extract<{ provider: 'linkedin'; options: LinkedInLoginOptions; }, { provider: T; }> | Extract<{ provider: 'oauth2'; options: OAuth2LoginOptions; }, { provider: T; }>"
|
|
39
39
|
}
|
|
40
40
|
],
|
|
41
41
|
"returns": "Promise<{ provider: T; result: ProviderResponseMap[T]; }>",
|
|
@@ -56,12 +56,12 @@
|
|
|
56
56
|
},
|
|
57
57
|
{
|
|
58
58
|
"name": "logout",
|
|
59
|
-
"signature": "(options: { provider: 'apple' | 'google' | 'facebook' | 'twitter' | 'telegram' | 'oauth2'; providerId?: string; }) => Promise<void>",
|
|
59
|
+
"signature": "(options: { provider: 'apple' | 'google' | 'facebook' | 'twitter' | 'telegram' | 'linkedin' | 'oauth2'; providerId?: string; }) => Promise<void>",
|
|
60
60
|
"parameters": [
|
|
61
61
|
{
|
|
62
62
|
"name": "options",
|
|
63
63
|
"docs": "",
|
|
64
|
-
"type": "{ provider: 'apple' | 'google' | 'facebook' | 'twitter' | 'oauth2' | 'telegram'; providerId?: string | undefined; }"
|
|
64
|
+
"type": "{ provider: 'apple' | 'google' | 'facebook' | 'twitter' | 'linkedin' | 'oauth2' | 'telegram'; providerId?: string | undefined; }"
|
|
65
65
|
}
|
|
66
66
|
],
|
|
67
67
|
"returns": "Promise<void>",
|
|
@@ -163,20 +163,20 @@
|
|
|
163
163
|
},
|
|
164
164
|
{
|
|
165
165
|
"name": "refreshToken",
|
|
166
|
-
"signature": "(options:
|
|
166
|
+
"signature": "(options: RefreshTokenOptions) => Promise<OAuth2LoginResponse>",
|
|
167
167
|
"parameters": [
|
|
168
168
|
{
|
|
169
169
|
"name": "options",
|
|
170
170
|
"docs": "",
|
|
171
|
-
"type": "
|
|
171
|
+
"type": "RefreshTokenOptions"
|
|
172
172
|
}
|
|
173
173
|
],
|
|
174
174
|
"returns": "Promise<OAuth2LoginResponse>",
|
|
175
175
|
"tags": [],
|
|
176
|
-
"docs": "OAuth2 refresh-token helper (feature parity with Capawesome OAuth).\n\nScope:\n-
|
|
176
|
+
"docs": "OAuth2 refresh-token helper (feature parity with Capawesome OAuth).\n\nScope:\n- Applies to the built-in `oauth2` provider and the LinkedIn convenience wrapper.\n- Requires a token endpoint (either `accessTokenEndpoint`/`tokenEndpoint` or `issuerUrl` discovery).\n\nSecurity note:\n- This does not validate JWT signatures. It only exchanges/refreshes tokens.\n\nIf `refreshToken` is omitted, the plugin will attempt to use the stored refresh token (if available).",
|
|
177
177
|
"complexTypes": [
|
|
178
178
|
"OAuth2LoginResponse",
|
|
179
|
-
"
|
|
179
|
+
"RefreshTokenOptions"
|
|
180
180
|
],
|
|
181
181
|
"slug": "refreshtoken"
|
|
182
182
|
},
|
|
@@ -186,7 +186,7 @@
|
|
|
186
186
|
"parameters": [],
|
|
187
187
|
"returns": "Promise<LoginResult | null>",
|
|
188
188
|
"tags": [],
|
|
189
|
-
"docs": "Web-only: handle the OAuth redirect callback and return the parsed result.\n\nNotes:\n- This is only meaningful on Web. iOS/Android implementations will reject.\n- Intended for redirect-based flows (e.g. `oauth2` with `flow: 'redirect'`) where the page navigates away
|
|
189
|
+
"docs": "Web-only: handle the OAuth redirect callback and return the parsed result.\n\nNotes:\n- This is only meaningful on Web. iOS/Android implementations will reject.\n- Intended for redirect-based flows (e.g. `oauth2` with `flow: 'redirect'`) where the page navigates away.\n- LinkedIn convenience logins (`provider: 'linkedin'`, `flow: 'redirect'`) return `provider: 'linkedin'`.\n The same app used as `oauth2` with `providerId: 'linkedin'` keeps `provider: 'oauth2'`.",
|
|
190
190
|
"complexTypes": [
|
|
191
191
|
"LoginResult"
|
|
192
192
|
],
|
|
@@ -376,6 +376,15 @@
|
|
|
376
376
|
"complexTypes": [],
|
|
377
377
|
"type": "{ botId: string; redirectUrl?: string | undefined; origin?: string | undefined; requestAccess?: 'read' | 'write' | undefined; languageCode?: string | undefined; } | undefined"
|
|
378
378
|
},
|
|
379
|
+
{
|
|
380
|
+
"name": "linkedin",
|
|
381
|
+
"tags": [],
|
|
382
|
+
"docs": "LinkedIn configuration.\nConvenience wrapper that maps to the OAuth2 provider using LinkedIn defaults.",
|
|
383
|
+
"complexTypes": [
|
|
384
|
+
"LinkedInProviderConfig"
|
|
385
|
+
],
|
|
386
|
+
"type": "LinkedInProviderConfig"
|
|
387
|
+
},
|
|
379
388
|
{
|
|
380
389
|
"name": "twitter",
|
|
381
390
|
"tags": [],
|
|
@@ -715,6 +724,41 @@
|
|
|
715
724
|
}
|
|
716
725
|
]
|
|
717
726
|
},
|
|
727
|
+
{
|
|
728
|
+
"name": "LinkedInProviderConfig",
|
|
729
|
+
"slug": "linkedinproviderconfig",
|
|
730
|
+
"docs": "LinkedIn provider configuration (convenience wrapper around the generic OAuth2 provider).\n\nUses the OAuth2 engine with LinkedIn defaults:\n- Authorization URL: https://www.linkedin.com/oauth/v2/authorization\n- Token URL: https://www.linkedin.com/oauth/v2/accessToken\n- Resource URL: https://api.linkedin.com/v2/userinfo\n- Default scopes: `openid profile email`",
|
|
731
|
+
"tags": [],
|
|
732
|
+
"methods": [],
|
|
733
|
+
"properties": [
|
|
734
|
+
{
|
|
735
|
+
"name": "clientId",
|
|
736
|
+
"tags": [],
|
|
737
|
+
"docs": "LinkedIn Client ID from the LinkedIn Developer Portal.",
|
|
738
|
+
"complexTypes": [],
|
|
739
|
+
"type": "string"
|
|
740
|
+
},
|
|
741
|
+
{
|
|
742
|
+
"name": "redirectUrl",
|
|
743
|
+
"tags": [
|
|
744
|
+
{
|
|
745
|
+
"text": "'https://your-app.example/auth/linkedin'",
|
|
746
|
+
"name": "example"
|
|
747
|
+
}
|
|
748
|
+
],
|
|
749
|
+
"docs": "Redirect URL that receives the OAuth callback.\nMust match a redirect URL configured in the LinkedIn Developer Portal.",
|
|
750
|
+
"complexTypes": [],
|
|
751
|
+
"type": "string"
|
|
752
|
+
},
|
|
753
|
+
{
|
|
754
|
+
"name": "clientSecret",
|
|
755
|
+
"tags": [],
|
|
756
|
+
"docs": "LinkedIn Client Secret.\n\nPrefer exchanging the authorization code on a backend when possible.\nNeeded for confidential clients that do not use PKCE-only token exchange.",
|
|
757
|
+
"complexTypes": [],
|
|
758
|
+
"type": "string | undefined"
|
|
759
|
+
}
|
|
760
|
+
]
|
|
761
|
+
},
|
|
718
762
|
{
|
|
719
763
|
"name": "FacebookLoginResponse",
|
|
720
764
|
"slug": "facebookloginresponse",
|
|
@@ -1706,7 +1750,7 @@
|
|
|
1706
1750
|
],
|
|
1707
1751
|
"docs": "Provider",
|
|
1708
1752
|
"complexTypes": [],
|
|
1709
|
-
"type": "'apple' | 'google' | 'facebook' | 'twitter' | 'oauth2' | 'telegram'"
|
|
1753
|
+
"type": "'apple' | 'google' | 'facebook' | 'twitter' | 'linkedin' | 'oauth2' | 'telegram'"
|
|
1710
1754
|
},
|
|
1711
1755
|
{
|
|
1712
1756
|
"name": "providerId",
|
|
@@ -1772,7 +1816,7 @@
|
|
|
1772
1816
|
],
|
|
1773
1817
|
"docs": "Provider",
|
|
1774
1818
|
"complexTypes": [],
|
|
1775
|
-
"type": "'apple' | 'google' | 'facebook' | 'twitter' | 'oauth2'"
|
|
1819
|
+
"type": "'apple' | 'google' | 'facebook' | 'twitter' | 'linkedin' | 'oauth2'"
|
|
1776
1820
|
},
|
|
1777
1821
|
{
|
|
1778
1822
|
"name": "providerId",
|
|
@@ -2015,13 +2059,14 @@
|
|
|
2015
2059
|
"docs": "",
|
|
2016
2060
|
"types": [
|
|
2017
2061
|
{
|
|
2018
|
-
"text": "{\n facebook: FacebookLoginResponse;\n google: GoogleLoginResponse;\n apple: AppleProviderResponse;\n twitter: TwitterLoginResponse;\n telegram: TelegramLoginResponse;\n oauth2: OAuth2LoginResponse;\n}",
|
|
2062
|
+
"text": "{\n facebook: FacebookLoginResponse;\n google: GoogleLoginResponse;\n apple: AppleProviderResponse;\n twitter: TwitterLoginResponse;\n telegram: TelegramLoginResponse;\n linkedin: LinkedInLoginResponse;\n oauth2: OAuth2LoginResponse;\n}",
|
|
2019
2063
|
"complexTypes": [
|
|
2020
2064
|
"FacebookLoginResponse",
|
|
2021
2065
|
"GoogleLoginResponse",
|
|
2022
2066
|
"AppleProviderResponse",
|
|
2023
2067
|
"TwitterLoginResponse",
|
|
2024
2068
|
"TelegramLoginResponse",
|
|
2069
|
+
"LinkedInLoginResponse",
|
|
2025
2070
|
"OAuth2LoginResponse"
|
|
2026
2071
|
]
|
|
2027
2072
|
}
|
|
@@ -2046,6 +2091,19 @@
|
|
|
2046
2091
|
}
|
|
2047
2092
|
]
|
|
2048
2093
|
},
|
|
2094
|
+
{
|
|
2095
|
+
"name": "LinkedInLoginResponse",
|
|
2096
|
+
"slug": "linkedinloginresponse",
|
|
2097
|
+
"docs": "LinkedIn login response (returned when using the LinkedIn convenience API).",
|
|
2098
|
+
"types": [
|
|
2099
|
+
{
|
|
2100
|
+
"text": "OAuth2LoginResponse",
|
|
2101
|
+
"complexTypes": [
|
|
2102
|
+
"OAuth2LoginResponse"
|
|
2103
|
+
]
|
|
2104
|
+
}
|
|
2105
|
+
]
|
|
2106
|
+
},
|
|
2049
2107
|
{
|
|
2050
2108
|
"name": "LoginOptions",
|
|
2051
2109
|
"slug": "loginoptions",
|
|
@@ -2081,6 +2139,12 @@
|
|
|
2081
2139
|
"TelegramLoginOptions"
|
|
2082
2140
|
]
|
|
2083
2141
|
},
|
|
2142
|
+
{
|
|
2143
|
+
"text": "{\n provider: 'linkedin';\n options: LinkedInLoginOptions;\n }",
|
|
2144
|
+
"complexTypes": [
|
|
2145
|
+
"LinkedInLoginOptions"
|
|
2146
|
+
]
|
|
2147
|
+
},
|
|
2084
2148
|
{
|
|
2085
2149
|
"text": "{\n provider: 'oauth2';\n options: OAuth2LoginOptions;\n }",
|
|
2086
2150
|
"complexTypes": [
|
|
@@ -2089,6 +2153,65 @@
|
|
|
2089
2153
|
}
|
|
2090
2154
|
]
|
|
2091
2155
|
},
|
|
2156
|
+
{
|
|
2157
|
+
"name": "LinkedInLoginOptions",
|
|
2158
|
+
"slug": "linkedinloginoptions",
|
|
2159
|
+
"docs": "LinkedIn login options (maps to the OAuth2 provider internally).\n`providerId` is set to `linkedin` automatically.",
|
|
2160
|
+
"types": [
|
|
2161
|
+
{
|
|
2162
|
+
"text": "Omit<OAuth2LoginOptions, 'providerId'>",
|
|
2163
|
+
"complexTypes": [
|
|
2164
|
+
"Omit",
|
|
2165
|
+
"OAuth2LoginOptions"
|
|
2166
|
+
]
|
|
2167
|
+
}
|
|
2168
|
+
]
|
|
2169
|
+
},
|
|
2170
|
+
{
|
|
2171
|
+
"name": "Omit",
|
|
2172
|
+
"slug": "omit",
|
|
2173
|
+
"docs": "Construct a type with the properties of T except for those in type K.",
|
|
2174
|
+
"types": [
|
|
2175
|
+
{
|
|
2176
|
+
"text": "Pick<T, Exclude<keyof T, K>>",
|
|
2177
|
+
"complexTypes": [
|
|
2178
|
+
"Pick",
|
|
2179
|
+
"T",
|
|
2180
|
+
"Exclude",
|
|
2181
|
+
"K"
|
|
2182
|
+
]
|
|
2183
|
+
}
|
|
2184
|
+
]
|
|
2185
|
+
},
|
|
2186
|
+
{
|
|
2187
|
+
"name": "Pick",
|
|
2188
|
+
"slug": "pick",
|
|
2189
|
+
"docs": "From T, pick a set of properties whose keys are in the union K",
|
|
2190
|
+
"types": [
|
|
2191
|
+
{
|
|
2192
|
+
"text": "{\r\n [P in K]: T[P];\r\n}",
|
|
2193
|
+
"complexTypes": [
|
|
2194
|
+
"K",
|
|
2195
|
+
"T",
|
|
2196
|
+
"P"
|
|
2197
|
+
]
|
|
2198
|
+
}
|
|
2199
|
+
]
|
|
2200
|
+
},
|
|
2201
|
+
{
|
|
2202
|
+
"name": "Exclude",
|
|
2203
|
+
"slug": "exclude",
|
|
2204
|
+
"docs": "Exclude from T those types that are assignable to U",
|
|
2205
|
+
"types": [
|
|
2206
|
+
{
|
|
2207
|
+
"text": "T extends U ? never : T",
|
|
2208
|
+
"complexTypes": [
|
|
2209
|
+
"T",
|
|
2210
|
+
"U"
|
|
2211
|
+
]
|
|
2212
|
+
}
|
|
2213
|
+
]
|
|
2214
|
+
},
|
|
2092
2215
|
{
|
|
2093
2216
|
"name": "Extract",
|
|
2094
2217
|
"slug": "extract",
|
|
@@ -2103,6 +2226,25 @@
|
|
|
2103
2226
|
}
|
|
2104
2227
|
]
|
|
2105
2228
|
},
|
|
2229
|
+
{
|
|
2230
|
+
"name": "RefreshTokenOptions",
|
|
2231
|
+
"slug": "refreshtokenoptions",
|
|
2232
|
+
"docs": "Options for `refreshToken()`.\n`providerId` is required for generic `oauth2` and ignored for LinkedIn.",
|
|
2233
|
+
"types": [
|
|
2234
|
+
{
|
|
2235
|
+
"text": "{\n provider: 'oauth2';\n providerId: string;\n refreshToken?: string;\n additionalParameters?: Record<string, string>;\n }",
|
|
2236
|
+
"complexTypes": [
|
|
2237
|
+
"Record"
|
|
2238
|
+
]
|
|
2239
|
+
},
|
|
2240
|
+
{
|
|
2241
|
+
"text": "{\n provider: 'linkedin';\n providerId?: string;\n refreshToken?: string;\n additionalParameters?: Record<string, string>;\n }",
|
|
2242
|
+
"complexTypes": [
|
|
2243
|
+
"Record"
|
|
2244
|
+
]
|
|
2245
|
+
}
|
|
2246
|
+
]
|
|
2247
|
+
},
|
|
2106
2248
|
{
|
|
2107
2249
|
"name": "LoginResult",
|
|
2108
2250
|
"slug": "loginresult",
|
|
@@ -2138,6 +2280,12 @@
|
|
|
2138
2280
|
"TelegramLoginResponse"
|
|
2139
2281
|
]
|
|
2140
2282
|
},
|
|
2283
|
+
{
|
|
2284
|
+
"text": "{\n provider: 'linkedin';\n result: LinkedInLoginResponse;\n }",
|
|
2285
|
+
"complexTypes": [
|
|
2286
|
+
"LinkedInLoginResponse"
|
|
2287
|
+
]
|
|
2288
|
+
},
|
|
2141
2289
|
{
|
|
2142
2290
|
"text": "{\n provider: 'oauth2';\n result: OAuth2LoginResponse;\n }",
|
|
2143
2291
|
"complexTypes": [
|
package/dist/esm/auth-connect.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
|
-
import {
|
|
2
|
+
import { SocialLogin } from './social-login';
|
|
3
3
|
const AUTH_CONNECT_PROVIDERS = ['auth0', 'azure', 'cognito', 'okta', 'onelogin'];
|
|
4
4
|
const DEFAULT_SCOPES = {
|
|
5
5
|
auth0: 'openid profile email offline_access',
|
|
@@ -203,6 +203,6 @@ const createAuthConnectClient = (client) => ({
|
|
|
203
203
|
providerSpecificCall: async (options) => client.providerSpecificCall(options),
|
|
204
204
|
getPluginVersion: async () => client.getPluginVersion(),
|
|
205
205
|
});
|
|
206
|
-
const SocialLoginAuthConnect = createAuthConnectClient(
|
|
206
|
+
const SocialLoginAuthConnect = createAuthConnectClient(SocialLogin);
|
|
207
207
|
export { createAuthConnectClient, SocialLoginAuthConnect };
|
|
208
208
|
//# sourceMappingURL=auth-connect.js.map
|