@capgo/capacitor-social-login 8.5.3 → 8.5.5

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.
@@ -42,6 +42,8 @@ struct OAuth2AccessToken {
42
42
  struct OAuth2ProviderConfig {
43
43
  let appId: String
44
44
  let clientSecret: String?
45
+ let clientIdParamName: String
46
+ let clientSecretParamName: String
45
47
  let issuerUrl: String?
46
48
  var authorizationBaseUrl: String?
47
49
  var accessTokenEndpoint: String?
@@ -79,6 +81,14 @@ class OAuth2Provider: NSObject {
79
81
  return ""
80
82
  }
81
83
 
84
+ private func stringParam(_ value: Any?, fallback: String) -> String {
85
+ let trimmed = (value as? String)?.trimmingCharacters(in: .whitespacesAndNewlines)
86
+ if let trimmed, !trimmed.isEmpty {
87
+ return trimmed
88
+ }
89
+ return fallback
90
+ }
91
+
82
92
  func initializeProviders(configs: [String: [String: Any]]) -> [String] {
83
93
  var errors: [String] = []
84
94
 
@@ -105,6 +115,8 @@ class OAuth2Provider: NSObject {
105
115
  let providerConfig = OAuth2ProviderConfig(
106
116
  appId: resolvedAppId,
107
117
  clientSecret: config["clientSecret"] as? String,
118
+ clientIdParamName: stringParam(config["clientIdParamName"], fallback: "client_id"),
119
+ clientSecretParamName: stringParam(config["clientSecretParamName"], fallback: "client_secret"),
108
120
  issuerUrl: issuerUrl,
109
121
  authorizationBaseUrl: (authorizationBaseUrl?.isEmpty == false ? authorizationBaseUrl : nil),
110
122
  accessTokenEndpoint:
@@ -239,7 +251,7 @@ class OAuth2Provider: NSObject {
239
251
  var components = URLComponents(string: authorizationBaseUrl)
240
252
  var queryItems: [URLQueryItem] = [
241
253
  URLQueryItem(name: "response_type", value: config.responseType),
242
- URLQueryItem(name: "client_id", value: config.appId),
254
+ URLQueryItem(name: config.clientIdParamName, value: config.appId),
243
255
  URLQueryItem(name: "redirect_uri", value: redirect),
244
256
  URLQueryItem(name: "state", value: state)
245
257
  ]
@@ -459,7 +471,7 @@ class OAuth2Provider: NSObject {
459
471
 
460
472
  var body: [String: String] = [
461
473
  "grant_type": "authorization_code",
462
- "client_id": config.appId,
474
+ config.clientIdParamName: config.appId,
463
475
  "code": code,
464
476
  "redirect_uri": redirectUri
465
477
  ]
@@ -469,7 +481,7 @@ class OAuth2Provider: NSObject {
469
481
  }
470
482
 
471
483
  if let secret = config.clientSecret {
472
- body["client_secret"] = secret
484
+ body[config.clientSecretParamName] = secret
473
485
  }
474
486
 
475
487
  if let extra = config.additionalTokenParameters {
@@ -499,11 +511,11 @@ class OAuth2Provider: NSObject {
499
511
  var body: [String: String] = [
500
512
  "grant_type": "refresh_token",
501
513
  "refresh_token": refreshToken,
502
- "client_id": config.appId
514
+ config.clientIdParamName: config.appId
503
515
  ]
504
516
 
505
517
  if let secret = config.clientSecret {
506
- body["client_secret"] = secret
518
+ body[config.clientSecretParamName] = secret
507
519
  }
508
520
  if let extra = config.additionalTokenParameters {
509
521
  for (k, v) in extra { body[k] = v }
@@ -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.5.3"
19
+ private let pluginVersion: String = "8.5.5"
20
20
  public let identifier = "SocialLoginPlugin"
21
21
  public let jsName = "SocialLogin"
22
22
  private static let userCancelledCode = "USER_CANCELLED"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-social-login",
3
- "version": "8.5.3",
3
+ "version": "8.5.5",
4
4
  "description": "All social logins in one plugin",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",