@capgo/capacitor-social-login 8.7.0 → 8.7.2
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 +10 -10
- package/android/src/main/java/ee/forgr/capacitor/social/login/OAuth2Provider.java +1 -1
- package/android/src/main/java/ee/forgr/capacitor/social/login/SocialLoginPlugin.java +1 -1
- package/dist/docs.json +1 -1
- package/dist/esm/definitions.d.ts +3 -1
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/oauth-popup-bridge.js +2 -1
- package/dist/esm/oauth-popup-bridge.js.map +1 -1
- package/dist/plugin.cjs.js +2 -11
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +2 -11
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/SocialLoginPlugin/GoogleProvider.swift +6 -4
- package/ios/Sources/SocialLoginPlugin/SocialLoginPlugin.swift +1 -1
- package/package.json +1 -1
|
@@ -40,6 +40,9 @@ class GoogleProvider {
|
|
|
40
40
|
self.forceAuthCode = false
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
// Extract nonce from payload if provided
|
|
44
|
+
let nonce = payload["nonce"] as? String
|
|
45
|
+
|
|
43
46
|
func login() {
|
|
44
47
|
guard let presentingVc = PresentationWindowResolver
|
|
45
48
|
.window(hostViewController: self.hostViewController)?.rootViewController else {
|
|
@@ -53,9 +56,6 @@ class GoogleProvider {
|
|
|
53
56
|
scopes = Array(Set(scopes + ["offline_access"]))
|
|
54
57
|
}
|
|
55
58
|
|
|
56
|
-
// Extract nonce from payload if provided
|
|
57
|
-
let nonce = payload["nonce"] as? String
|
|
58
|
-
|
|
59
59
|
GIDSignIn.sharedInstance.signIn(
|
|
60
60
|
withPresenting: presentingVc,
|
|
61
61
|
hint: nil,
|
|
@@ -82,7 +82,9 @@ class GoogleProvider {
|
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
// A restored sign-in returns an ID token minted without this call's nonce, which a
|
|
86
|
+
// backend that checks the nonce rejects. So a login with a nonce always signs in.
|
|
87
|
+
if GIDSignIn.sharedInstance.hasPreviousSignIn() && !self.forceAuthCode && self.mode != .OFFLINE && nonce == nil {
|
|
86
88
|
GIDSignIn.sharedInstance.restorePreviousSignIn { user, error in
|
|
87
89
|
if error != nil {
|
|
88
90
|
// Retry interactive login when restoring the previous session fails.
|
|
@@ -16,7 +16,7 @@ import GoogleSignIn
|
|
|
16
16
|
*/
|
|
17
17
|
@objc(SocialLoginPlugin)
|
|
18
18
|
public class SocialLoginPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
19
|
-
private let pluginVersion: String = "8.7.
|
|
19
|
+
private let pluginVersion: String = "8.7.2"
|
|
20
20
|
public let identifier = "SocialLoginPlugin"
|
|
21
21
|
public let jsName = "SocialLogin"
|
|
22
22
|
private static let userCancelledCode = "USER_CANCELLED"
|