@capgo/capacitor-social-login 8.3.16 → 8.3.18

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.
@@ -16,6 +16,7 @@ class GoogleProvider {
16
16
  var additionalScopes: [String]!
17
17
  var defaultGrantedScopes = ["email", "profile", "openid"]
18
18
  var mode = GoogleProviderLoginType.ONLINE
19
+ private let offlineRefreshNotSupportedMessage = "Google refresh() is not available when using offline mode. Offline mode only returns serverAuthCode for backend token exchange. Send serverAuthCode to your backend and refresh tokens there, or switch google.mode to 'online' for client-side refresh."
19
20
 
20
21
  func initialize(clientId: String, mode: GoogleProviderLoginType, serverClientId: String? = nil, hostedDomain: String? = nil) {
21
22
  configuration = GIDConfiguration(clientID: clientId, serverClientID: serverClientId, hostedDomain: hostedDomain, openIDRealm: nil)
@@ -194,6 +195,11 @@ class GoogleProvider {
194
195
  }
195
196
 
196
197
  func refresh(completion: @escaping (Result<Void, Error>) -> Void) {
198
+ if self.mode == .OFFLINE {
199
+ print("[GoogleProvider] \(offlineRefreshNotSupportedMessage)")
200
+ completion(.failure(NSError(domain: "GoogleProvider", code: 0, userInfo: [NSLocalizedDescriptionKey: offlineRefreshNotSupportedMessage])))
201
+ return
202
+ }
197
203
  DispatchQueue.main.async {
198
204
  guard let currentUser = GIDSignIn.sharedInstance.currentUser else {
199
205
  completion(.failure(NSError(domain: "GoogleProvider", code: 0, userInfo: [NSLocalizedDescriptionKey: "User not logged in"])))
@@ -41,6 +41,7 @@ struct OAuth2AccessToken {
41
41
 
42
42
  struct OAuth2ProviderConfig {
43
43
  let appId: String
44
+ let clientSecret: String?
44
45
  let issuerUrl: String?
45
46
  var authorizationBaseUrl: String?
46
47
  var accessTokenEndpoint: String?
@@ -103,6 +104,7 @@ class OAuth2Provider: NSObject {
103
104
 
104
105
  let providerConfig = OAuth2ProviderConfig(
105
106
  appId: resolvedAppId,
107
+ clientSecret: config["clientSecret"] as? String,
106
108
  issuerUrl: issuerUrl,
107
109
  authorizationBaseUrl: (authorizationBaseUrl?.isEmpty == false ? authorizationBaseUrl : nil),
108
110
  accessTokenEndpoint:
@@ -466,6 +468,10 @@ class OAuth2Provider: NSObject {
466
468
  body["code_verifier"] = codeVerifier
467
469
  }
468
470
 
471
+ if let secret = config.clientSecret {
472
+ body["client_secret"] = secret
473
+ }
474
+
469
475
  if let extra = config.additionalTokenParameters {
470
476
  for (k, v) in extra { body[k] = v }
471
477
  }
@@ -496,6 +502,9 @@ class OAuth2Provider: NSObject {
496
502
  "client_id": config.appId
497
503
  ]
498
504
 
505
+ if let secret = config.clientSecret {
506
+ body["client_secret"] = secret
507
+ }
499
508
  if let extra = config.additionalTokenParameters {
500
509
  for (k, v) in extra { body[k] = v }
501
510
  }
@@ -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.3.16"
19
+ private let pluginVersion: String = "8.3.18"
20
20
  public let identifier = "SocialLoginPlugin"
21
21
  public let jsName = "SocialLogin"
22
22
  public let pluginMethods: [CAPPluginMethod] = [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-social-login",
3
- "version": "8.3.16",
3
+ "version": "8.3.18",
4
4
  "description": "All social logins in one plugin",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",