@capgo/capacitor-social-login 8.5.11 → 8.5.13

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.
@@ -19,6 +19,5 @@ Pod::Spec.new do |s|
19
19
  s.dependency 'FBSDKCoreKit', '~> 18.0'
20
20
  s.dependency 'FBSDKLoginKit', '~> 18.0'
21
21
  s.dependency 'GoogleSignIn', '~> 9.0.0'
22
- s.dependency 'Alamofire', '~> 5.10.2'
23
22
  s.swift_version = '5.1'
24
23
  end
package/Package.swift CHANGED
@@ -14,9 +14,7 @@ let package = Package(
14
14
  // FBSDKCoreKit and FBSDKLoginKit
15
15
  .package(url: "https://github.com/facebook/facebook-ios-sdk.git", .upToNextMajor(from: "18.0.3")),
16
16
  // Add Google Sign-In dependency
17
- .package(url: "https://github.com/google/GoogleSignIn-iOS.git", .upToNextMajor(from: "9.0.0")),
18
- // Alamofire
19
- .package(url: "https://github.com/Alamofire/Alamofire.git", .upToNextMajor(from: "5.11.2"))
17
+ .package(url: "https://github.com/google/GoogleSignIn-iOS.git", .upToNextMajor(from: "9.0.0"))
20
18
  ],
21
19
  targets: [
22
20
  .target(
@@ -26,8 +24,7 @@ let package = Package(
26
24
  .product(name: "Cordova", package: "capacitor-swift-pm"),
27
25
  .product(name: "FacebookCore", package: "facebook-ios-sdk"),
28
26
  .product(name: "FacebookLogin", package: "facebook-ios-sdk"),
29
- .product(name: "GoogleSignIn", package: "GoogleSignIn-iOS"),
30
- .product(name: "Alamofire", package: "Alamofire")
27
+ .product(name: "GoogleSignIn", package: "GoogleSignIn-iOS")
31
28
  ],
32
29
  path: "ios/Sources/SocialLoginPlugin"),
33
30
  .testTarget(
package/README.md CHANGED
@@ -1,11 +1,29 @@
1
1
  # @capgo/capacitor-social-login
2
- <a href="https://capgo.app/"><img src="https://capgo.app/readme-banner.svg?repo=Cap-go/capacitor-social-login" alt="Capgo - Instant updates for Capacitor" /></a>
2
+
3
+ Add Google, Apple, Facebook and other social sign-ins to your Capacitor app with one plugin and one API across iOS, Android and the web.
4
+
5
+ <a href="https://capgo.app/?ref=plugin_social_login"><img src="https://capgo.app/readme-banner.svg?repo=Cap-go/capacitor-social-login" alt="Capgo - Instant updates for Capacitor" /></a>
3
6
 
4
7
  <div align="center">
5
- <h2><a href="https://capgo.app/?ref=plugin_social_login"> ➡️ Get Instant updates for your App with Capgo</a></h2>
6
- <h2><a href="https://capgo.app/consulting/?ref=plugin_social_login"> Missing a feature? We’ll build the plugin for you 💪</a></h2>
8
+ <p><b>Capgo</b>: open-source live updates for Ionic and Capacitor apps. Ship OTA fixes and features instantly, without waiting for app store review.</p>
9
+ <h2><a href="https://capgo.app/register/?ref=plugin_social_login">➡️ Get started for free</a></h2>
10
+ <p>14-day unlimited free trial. No credit card required</p>
11
+ <p><a href="https://capgo.app/consulting/?ref=plugin_social_login">Missing a feature? We'll build the plugin for you 💪</a></p>
7
12
  </div>
8
13
 
14
+ <p align="center">
15
+ <img src="https://raw.githubusercontent.com/Cap-go/capacitor-social-login/main/assets/github-social-preview.png" alt="@capgo/capacitor-social-login for Capacitor apps" width="300" />
16
+ </p>
17
+
18
+ ## Key features
19
+
20
+ - **Many providers**: Google, Apple, Facebook, Twitter (X), LinkedIn, TikTok, Telegram and generic OAuth2.
21
+ - **One API**: `initialize()`, `login()`, `logout()`, `isLoggedIn()` and `getAuthorizationCode()`.
22
+ - **Tokens**: `refresh()`, `refreshToken()`, `decodeIdToken()` and expiry helpers.
23
+ - **Native sign-in**: Sign in with Apple, Google Sign-In and the Facebook SDK on iOS, Credential Manager on Android.
24
+ - **Web OAuth**: `handleRedirectCallback()` and `openSecureWindow()` for redirect and popup flows.
25
+ - **Platforms**: iOS, Android and Web. Check the docs for each provider's setup on each platform.
26
+
9
27
  ## Fork Information
10
28
  This plugin is a fork of [@codetrix-studio/capacitor-google-auth](https://github.com/CodetrixStudio/CapacitorGoogleAuth). We created this fork because the original plugin is "virtually" archived with no way to reach the maintainer in any medium, and only one person (@reslear) has write rights but doesn't handle native code.
11
29
 
@@ -94,7 +112,7 @@ const config: CapacitorConfig = {
94
112
  providers: {
95
113
  google: true, // true = enabled (bundled), false = disabled (not bundled)
96
114
  facebook: true, // Use false to reduce app size
97
- apple: true, // Apple uses system APIs; Alamofire only for redirectUrl backend flows
115
+ apple: true, // Apple uses system APIs only (no third-party networking dependency)
98
116
  twitter: false // false = disabled (not bundled)
99
117
  },
100
118
  logLevel: 1 // Warnings and errors only
@@ -117,8 +135,8 @@ export default config;
117
135
  - **Important**: Disabling a provider (`false`) will make it unavailable at runtime, regardless of whether it actually adds any dependencies. The provider will be disabled even if it uses only system APIs.
118
136
  - This configuration only affects iOS and Android platforms; it does not affect the web platform.
119
137
  - **Important**: Using `false` means the dependency won't be bundled, but the plugin code still compiles against it. Ensure the consuming app includes the dependency if needed.
120
- - **Facebook**: When `facebook: false`, the Facebook SDK is omitted and the plugin compiles a provider stub in its own package — no `com.facebook.*` classes are shipped (avoids privacy-scanner false positives).
121
- - **Apple (iOS)**: `apple: true` enables Sign in with Apple (AuthenticationServices; no external SDK for basic login). Alamofire is only linked when using `redirectUrl` / backend token exchange. `apple: false` removes Alamofire and disables Apple authentication at runtime—including basic Sign in with Apple—consistent with the rule above that `false` providers are unavailable at runtime. CocoaPods and Swift Package Manager both toggle Alamofire based on `apple: true|false`.
138
+ - **Facebook**: When `facebook: false`, the Facebook SDK is omitted and the plugin compiles a provider stub in its own package, no `com.facebook.*` classes are shipped (avoids privacy-scanner false positives).
139
+ - **Apple (iOS)**: `apple: true` enables Sign in with Apple (AuthenticationServices). Redirect URL and backend token exchange use Foundation URLSession, so no third-party networking library is required. `apple: false` disables Apple authentication at runtime, including basic Sign in with Apple, consistent with the rule above that `false` providers are unavailable at runtime.
122
140
  - Apple Sign-In on Android uses OAuth flow without external SDK dependencies
123
141
  - Twitter uses standard OAuth 2.0 flow without external SDK dependencies
124
142
 
@@ -441,15 +459,15 @@ You need **two kinds** of OAuth 2.0 client IDs:
441
459
  | Client type | Used for | Where it goes |
442
460
  |-------------|----------|---------------|
443
461
  | **Web application** | Server / ID token audience | `webClientId` in `SocialLogin.initialize()` |
444
- | **Android** (one per signing key) | Proves your APK is allowed to call Google | Google Cloud Console only — **do not** pass this ID to `webClientId` |
462
+ | **Android** (one per signing key) | Proves your APK is allowed to call Google | Google Cloud Console only, **do not** pass this ID to `webClientId` |
445
463
 
446
464
  Common mistake: using the **Android** client ID as `webClientId`. Credential Manager requires the **Web** client ID there. The Android client only needs the correct **package name + SHA-1** registered in the console.
447
465
 
448
466
  Create one Android OAuth client for **each** certificate that signs builds you test:
449
467
 
450
- - **Debug** — from `./gradlew signingReport` (debug variant)
451
- - **Release** — from the APK/AAB you actually install (see below)
452
- - **Play App Signing** — from Play Console → **App integrity** → **App signing key certificate** (required for Play Store builds even if your upload key SHA-1 is already registered)
468
+ - **Debug**, from `./gradlew signingReport` (debug variant)
469
+ - **Release**, from the APK/AAB you actually install (see below)
470
+ - **Play App Signing**, from Play Console → **App integrity** → **App signing key certificate** (required for Play Store builds even if your upload key SHA-1 is already registered)
453
471
 
454
472
  The `applicationId` in `android/app/build.gradle` must match the Android OAuth client package name exactly (including any `.debug` suffix if you use one).
455
473
 
@@ -464,13 +482,13 @@ This almost always means Google rejected the combination of **installed APK sign
464
482
  1. Confirm `webClientId` is the **Web application** client ID (ends with `.apps.googleusercontent.com`).
465
483
  2. Run the app, reproduce the failure, and read Logcat (`GoogleProvider`) for `signingSha1=` and `package=`.
466
484
  3. In [Google Cloud Console → Credentials](https://console.cloud.google.com/apis/credentials), open your **Android** OAuth client and verify that **exact** package name and SHA-1 are listed.
467
- 4. If testing a **release** build, register the SHA-1 from that build — not only the debug keystore.
485
+ 4. If testing a **release** build, register the SHA-1 from that build, not only the debug keystore.
468
486
  5. If the app is distributed via **Play Store**, also register the **Play App Signing** SHA-1.
469
487
  6. Ensure Web and Android clients live in the **same** Google Cloud project.
470
488
  7. If consent screen is in Testing, confirm the Google account is a **test user**.
471
489
  8. Wait and retry after console changes.
472
490
 
473
- `USER_CANCELLED` after picking an account on a misconfigured debug build can still be a SHA-1 / client-ID mismatch — fix the console setup above first.
491
+ `USER_CANCELLED` after picking an account on a misconfigured debug build can still be a SHA-1 / client-ID mismatch, fix the console setup above first.
474
492
 
475
493
  ##### Error `[16] Account reauth failed`
476
494
 
@@ -480,14 +498,14 @@ This error comes from Google Credential Manager when re-authenticating a cached
480
498
 
481
499
  If the retry still fails for specific users, check:
482
500
 
483
- 1. **OAuth consent screen** — must be **External** (Internal / Workspace-only blocks consumer `@gmail.com` accounts).
484
- 2. **Testing mode** — every failing Google account must be listed under **Audience → Test users**.
485
- 3. **Sign in with Google setting** — the user may have disabled your app under Google Account → **Sign in with Google**.
486
- 4. **Family Link / supervised accounts** — ensure `filterByAuthorizedAccounts` is not explicitly set to `true` (the default is `false`; see [Family Link section](#google-sign-in-with-family-link-supervised-accounts) below).
487
- 5. **Play App Signing SHA-1** — still required for Play Store builds even when most users succeed (some device/account paths are stricter).
488
- 6. **Explicit override** — if your app sets `filterByAuthorizedAccounts: true`, set it back to `false` for affected users; the default already skips authorized-account filtering.
501
+ 1. **OAuth consent screen**, must be **External** (Internal / Workspace-only blocks consumer `@gmail.com` accounts).
502
+ 2. **Testing mode**, every failing Google account must be listed under **Audience → Test users**.
503
+ 3. **Sign in with Google setting**, the user may have disabled your app under Google Account → **Sign in with Google**.
504
+ 4. **Family Link / supervised accounts**, ensure `filterByAuthorizedAccounts` is not explicitly set to `true` (the default is `false`; see [Family Link section](#google-sign-in-with-family-link-supervised-accounts) below).
505
+ 5. **Play App Signing SHA-1**, still required for Play Store builds even when most users succeed (some device/account paths are stricter).
506
+ 6. **Explicit override**, if your app sets `filterByAuthorizedAccounts: true`, set it back to `false` for affected users; the default already skips authorized-account filtering.
489
507
 
490
- After a failure, filter Logcat for `GoogleProvider` — the plugin logs `package`, `signingSha1`, and `webClientId`.
508
+ After a failure, filter Logcat for `GoogleProvider`, the plugin logs `package`, `signingSha1`, and `webClientId`.
491
509
 
492
510
  ##### Extract SHA-1 from the build you install
493
511
 
@@ -860,7 +878,7 @@ Then run `npx cap sync`. The plugin uses stub classes instead of the real Facebo
860
878
 
861
879
  On Android, this error comes from **Google Credential Manager** when the installed APK's signing certificate, package name, or `webClientId` does not match Google Cloud Console.
862
880
 
863
- See [Android troubleshooting (Credential Manager, SHA-1, and Firebase)](#android-troubleshooting-credential-manager-sha-1-and-firebase) for the full checklist. After a failed login, filter Logcat for `GoogleProvider` — the plugin prints `package`, `signingSha1`, and `webClientId` to compare with your OAuth clients.
881
+ See [Android troubleshooting (Credential Manager, SHA-1, and Firebase)](#android-troubleshooting-credential-manager-sha-1-and-firebase) for the full checklist. After a failed login, filter Logcat for `GoogleProvider`, the plugin prints `package`, `signingSha1`, and `webClientId` to compare with your OAuth clients.
864
882
 
865
883
  ### Google Sign-In `[16] Account reauth failed` (Android)
866
884
 
@@ -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.11";
27
+ private final String pluginVersion = "8.5.13";
28
28
 
29
29
  public static String LOG_TAG = "CapgoSocialLogin";
30
30
  public HashMap<String, SocialProvider> socialProviderHashMap = new HashMap<>();
@@ -1,10 +1,6 @@
1
1
  import Foundation
2
2
  import AuthenticationServices
3
3
 
4
- #if canImport(Alamofire)
5
- import Alamofire
6
- #endif
7
-
8
4
  import UIKit
9
5
  import Security
10
6
 
@@ -60,7 +56,6 @@ enum AppleProviderError: Error {
60
56
  case missingUserId
61
57
  case unknownError
62
58
  case invalidIdToken
63
- case alamofireNotAvailable
64
59
  }
65
60
 
66
61
  // Implement LocalizedError for AppleProviderError
@@ -99,14 +94,56 @@ extension AppleProviderError: LocalizedError {
99
94
  return NSLocalizedString("User ID not found in ID token.", comment: "")
100
95
  case .invalidIdToken:
101
96
  return NSLocalizedString("Invalid ID token format.", comment: "")
102
- case .alamofireNotAvailable:
103
- return NSLocalizedString("Apple redirectUrl / backend token exchange requires Alamofire. Add Alamofire to your Podfile or Package.swift, or remove redirectUrl to use basic Sign in with Apple.", comment: "")
104
97
  }
105
98
  }
106
99
  }
107
100
 
101
+ private final class NoRedirectURLSessionDelegate: NSObject, URLSessionTaskDelegate {
102
+ func urlSession(
103
+ _ session: URLSession,
104
+ task: URLSessionTask,
105
+ willPerformHTTPRedirection response: HTTPURLResponse,
106
+ newRequest request: URLRequest,
107
+ completionHandler: @escaping (URLRequest?) -> Void
108
+ ) {
109
+ completionHandler(nil)
110
+ }
111
+ }
112
+
113
+ private enum AppleProviderHTTP {
114
+ private static var formAllowedCharacters: CharacterSet {
115
+ var allowed = CharacterSet.alphanumerics
116
+ allowed.insert(charactersIn: "-._* ")
117
+ return allowed
118
+ }
119
+
120
+ static func applicationFormURLEncodedBody(from parameters: [String: String]) -> Data? {
121
+ let pairs = parameters.keys.sorted().compactMap { key -> String? in
122
+ guard let value = parameters[key] else { return nil }
123
+ let encodedKey = key.addingPercentEncoding(withAllowedCharacters: formAllowedCharacters)?.replacingOccurrences(of: " ", with: "+") ?? key
124
+ let encodedValue = value.addingPercentEncoding(withAllowedCharacters: formAllowedCharacters)?.replacingOccurrences(of: " ", with: "+") ?? value
125
+ return "\(encodedKey)=\(encodedValue)"
126
+ }
127
+ return pairs.joined(separator: "&").data(using: .utf8)
128
+ }
129
+
130
+ private static let sharedTokenExchangeSession: URLSession = {
131
+ URLSession(configuration: .default)
132
+ }()
133
+
134
+ static func tokenExchangeSession() -> URLSession {
135
+ sharedTokenExchangeSession
136
+ }
137
+
138
+ static func noRedirectSession() -> (session: URLSession, keeper: NoRedirectURLSessionDelegate) {
139
+ let delegate = NoRedirectURLSessionDelegate()
140
+ let session = URLSession(configuration: .default, delegate: delegate, delegateQueue: nil)
141
+ return (session, delegate)
142
+ }
143
+ }
144
+
108
145
  // Basic Sign in with Apple uses AuthenticationServices only.
109
- // Alamofire is required only for redirectUrl / backend token-exchange flows.
146
+ // redirectUrl / backend token-exchange flows use URLSession (Foundation).
110
147
  class AppleProvider: NSObject, ASAuthorizationControllerDelegate, ASAuthorizationControllerPresentationContextProviding {
111
148
  private var completion: ((Result<AppleProviderResponse, Error>) -> Void)?
112
149
 
@@ -315,7 +352,6 @@ class AppleProvider: NSObject, ASAuthorizationControllerDelegate, ASAuthorizatio
315
352
  )
316
353
 
317
354
  if !self.redirectUrl.isEmpty {
318
- #if canImport(Alamofire)
319
355
  let firstName = fullName?.givenName ?? ""
320
356
  let lastName = fullName?.familyName ?? ""
321
357
 
@@ -327,9 +363,6 @@ class AppleProvider: NSObject, ASAuthorizationControllerDelegate, ASAuthorizatio
327
363
  self.completion?(.failure(error))
328
364
  }
329
365
  }, skipUser: fullName?.givenName == nil)
330
- #else
331
- self.completion?(.failure(AppleProviderError.alamofireNotAvailable))
332
- #endif
333
366
  } else {
334
367
  do {
335
368
  try self.persistState(idToken: response.idToken ?? "", refreshToken: "", accessToken: "")
@@ -342,7 +375,6 @@ class AppleProvider: NSObject, ASAuthorizationControllerDelegate, ASAuthorizatio
342
375
  }
343
376
 
344
377
  // identityToken is the JWT generated by apple
345
- #if canImport(Alamofire)
346
378
  func sendRequest(
347
379
  code: String,
348
380
  identityToken: String,
@@ -376,23 +408,40 @@ class AppleProvider: NSObject, ASAuthorizationControllerDelegate, ASAuthorizatio
376
408
  parameters["user"] = userJSONString
377
409
  }
378
410
 
379
- // Send the POST request
380
- AF.request(
381
- self.redirectUrl,
382
- method: .post,
383
- parameters: parameters,
384
- encoding: URLEncoding.default,
385
- headers: [ "ios-plugin-version": "0.0.0" ]
386
- )
387
- .redirect(using: Redirector(behavior: .doNotFollow))
388
- .response { response in
389
- // Access the HTTPURLResponse
390
- if let httpResponse = response.response {
411
+ guard let url = URL(string: self.redirectUrl),
412
+ let body = AppleProviderHTTP.applicationFormURLEncodedBody(from: parameters) else {
413
+ DispatchQueue.main.async {
414
+ completion(.failure(.responseError(NSError(domain: "AppleProvider", code: -1, userInfo: [NSLocalizedDescriptionKey: "Invalid redirect URL"]))))
415
+ }
416
+ return
417
+ }
418
+
419
+ var request = URLRequest(url: url)
420
+ request.httpMethod = "POST"
421
+ request.httpBody = body
422
+ request.setValue("application/x-www-form-urlencoded; charset=utf-8", forHTTPHeaderField: "Content-Type")
423
+ request.setValue("0.0.0", forHTTPHeaderField: "ios-plugin-version")
424
+
425
+ let redirectSession = AppleProviderHTTP.noRedirectSession()
426
+
427
+ redirectSession.session.dataTask(with: request) { data, response, error in
428
+ DispatchQueue.main.async {
429
+ if let error = error {
430
+ completion(.failure(.responseError(error)))
431
+ print("Error: \(error)")
432
+ return
433
+ }
434
+
435
+ guard let httpResponse = response as? HTTPURLResponse else {
436
+ completion(.failure(.unknownError))
437
+ return
438
+ }
439
+
391
440
  print("Status Code: \(httpResponse.statusCode)")
392
441
 
393
442
  // Check if the response is a redirect
394
443
  if (300...399).contains(httpResponse.statusCode) {
395
- if let location = httpResponse.headers.value(for: "Location") {
444
+ if let location = httpResponse.value(forHTTPHeaderField: "Location") {
396
445
  print("Redirect Location: \(location)")
397
446
 
398
447
  // Parse the redirect URL
@@ -493,7 +542,7 @@ class AppleProvider: NSObject, ASAuthorizationControllerDelegate, ASAuthorizatio
493
542
  }
494
543
  } else {
495
544
  // Handle non-redirect responses
496
- if let data = response.data,
545
+ if let data = data,
497
546
  let responseString = String(data: data, encoding: .utf8) {
498
547
  print("Response: \(responseString)")
499
548
  } else {
@@ -502,11 +551,10 @@ class AppleProvider: NSObject, ASAuthorizationControllerDelegate, ASAuthorizatio
502
551
 
503
552
  completion(.failure(.invalidResponseCode(statusCode: httpResponse.statusCode)))
504
553
  }
505
- } else if let error = response.error {
506
- completion(.failure(.responseError(error)))
507
- print("Error: \(error)")
508
554
  }
509
- }
555
+ _ = redirectSession.keeper
556
+ }.resume()
557
+ redirectSession.session.finishTasksAndInvalidate()
510
558
  }
511
559
 
512
560
  func exchangeCodeForTokens(clientSecret: String, code: String, completion: @escaping ((Result<AppleProviderResponse, AppleProviderError>) -> Void)) {
@@ -518,16 +566,50 @@ class AppleProvider: NSObject, ASAuthorizationControllerDelegate, ASAuthorizatio
518
566
  "grant_type": "authorization_code"
519
567
  ]
520
568
 
521
- AF.request(
522
- TOKEN_URL,
523
- method: .post,
524
- parameters: parameters,
525
- encoder: URLEncodedFormParameterEncoder.default
526
- )
527
- .validate(statusCode: 200..<300) // Ensure the response status code is in the 200-299 range
528
- .responseDecodable(of: TokenResponse.self) { response in
529
- switch response.result {
530
- case .success(let tokenResponse):
569
+ guard let url = URL(string: TOKEN_URL),
570
+ let body = AppleProviderHTTP.applicationFormURLEncodedBody(from: parameters) else {
571
+ DispatchQueue.main.async {
572
+ completion(.failure(.responseError(NSError(domain: "AppleProvider", code: -1, userInfo: [NSLocalizedDescriptionKey: "Invalid token URL"]))))
573
+ }
574
+ return
575
+ }
576
+
577
+ var request = URLRequest(url: url)
578
+ request.httpMethod = "POST"
579
+ request.httpBody = body
580
+ request.setValue("application/x-www-form-urlencoded; charset=utf-8", forHTTPHeaderField: "Content-Type")
581
+
582
+ AppleProviderHTTP.tokenExchangeSession().dataTask(with: request) { data, response, error in
583
+ DispatchQueue.main.async {
584
+ if let error = error {
585
+ completion(.failure(.responseError(error)))
586
+ return
587
+ }
588
+
589
+ guard let httpResponse = response as? HTTPURLResponse else {
590
+ completion(.failure(.unknownError))
591
+ return
592
+ }
593
+
594
+ guard (200..<300).contains(httpResponse.statusCode) else {
595
+ print("error", HTTPURLResponse.localizedString(forStatusCode: httpResponse.statusCode))
596
+ completion(.failure(.invalidResponseCode(statusCode: httpResponse.statusCode)))
597
+ return
598
+ }
599
+
600
+ guard let data = data else {
601
+ completion(.failure(.jsonParsingError))
602
+ return
603
+ }
604
+
605
+ let tokenResponse: TokenResponse
606
+ do {
607
+ tokenResponse = try JSONDecoder().decode(TokenResponse.self, from: data)
608
+ } catch {
609
+ completion(.failure(.jsonParsingError))
610
+ return
611
+ }
612
+
531
613
  // Extract tokens from the response
532
614
  guard let accessToken = tokenResponse.access_token else {
533
615
  completion(.failure(.missingAccessToken))
@@ -596,17 +678,9 @@ class AppleProvider: NSObject, ASAuthorizationControllerDelegate, ASAuthorizatio
596
678
  } else {
597
679
  completion(.failure(.invalidIdToken))
598
680
  }
599
- case .failure(let error):
600
- if let statusCode = response.response?.statusCode {
601
- print("error", response.debugDescription)
602
- completion(.failure(.invalidResponseCode(statusCode: statusCode)))
603
- } else {
604
- completion(.failure(.responseError(error)))
605
- }
606
681
  }
607
- }
682
+ }.resume()
608
683
  }
609
- #endif
610
684
 
611
685
  func authorizationController(controller: ASAuthorizationController, didCompleteWithError error: Error) {
612
686
  completion?(.failure(error))
@@ -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.11"
19
+ private let pluginVersion: String = "8.5.13"
20
20
  public let identifier = "SocialLoginPlugin"
21
21
  public let jsName = "SocialLogin"
22
22
  private static let userCancelledCode = "USER_CANCELLED"
@@ -44,7 +44,7 @@ public class SocialLoginPlugin: CAPPlugin, CAPBridgedPlugin {
44
44
  ]
45
45
 
46
46
  // Providers - conditionally initialized based on available dependencies
47
- // Apple uses AuthenticationServices; Alamofire is only needed for redirectUrl flows
47
+ // Apple uses AuthenticationServices; redirectUrl flows use URLSession (Foundation)
48
48
  private let apple = AppleProvider()
49
49
 
50
50
  #if canImport(FBSDKLoginKit)
@@ -193,12 +193,6 @@ public class SocialLoginPlugin: CAPPlugin, CAPBridgedPlugin {
193
193
  }
194
194
  let redirectUrl = appleSettings["redirectUrl"] as? String
195
195
  let useProperTokenExchange = appleSettings["useProperTokenExchange"] as? Bool ?? false
196
- #if !canImport(Alamofire)
197
- if let redirectUrl = redirectUrl, !redirectUrl.isEmpty {
198
- call.reject("Apple redirectUrl requires Alamofire. Add Alamofire to your Podfile or Package.swift, or omit redirectUrl for basic Sign in with Apple.")
199
- return
200
- }
201
- #endif
202
196
  apple.initialize(redirectUrl: redirectUrl, useProperTokenExchange: useProperTokenExchange)
203
197
  initialized = true
204
198
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-social-login",
3
- "version": "8.5.11",
3
+ "version": "8.5.13",
4
4
  "description": "All social logins in one plugin",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",
@@ -289,13 +289,6 @@ function getPodspecReplacements(providerConfig) {
289
289
  ? `s.dependency 'FBSDKLoginKit', '~> 18.0'`
290
290
  : `# s.dependency 'FBSDKLoginKit', '~> 18.0' # Disabled via config (compileOnly)`,
291
291
  },
292
- {
293
- // Alamofire (for Apple) - handle both active and commented (including existing disabled comments)
294
- old: new RegExp(`(#[ \\t]*)?s\\.dependency\\s+'Alamofire',\\s*'~>\\s*5\\.10\\.2'${podspecTrailingComment}`),
295
- new: providerConfig.apple === 'implementation'
296
- ? `s.dependency 'Alamofire', '~> 5.10.2'`
297
- : `# s.dependency 'Alamofire', '~> 5.10.2' # Disabled via config (compileOnly)`,
298
- },
299
292
  ];
300
293
  }
301
294
  function getPackageSwiftReplacements(providerConfig) {
@@ -314,12 +307,6 @@ function getPackageSwiftReplacements(providerConfig) {
314
307
  ? `.package(url: "https://github.com/google/GoogleSignIn-iOS.git", .upToNextMajor(from: "9.0.0")),`
315
308
  : `// .package(url: "https://github.com/google/GoogleSignIn-iOS.git", .upToNextMajor(from: "9.0.0")), // Disabled via config (compileOnly)`,
316
309
  },
317
- {
318
- old: new RegExp(`${swiftCommentPrefix}\\.package\\(url:\\s*"https:\\/\\/github\\.com\\/Alamofire\\/Alamofire\\.git",\\s*\\.upToNextMajor\\(from:\\s*"[^"]+"\\)\\)${swiftTrailingComment}`),
319
- new: providerConfig.apple === 'implementation'
320
- ? `.package(url: "https://github.com/Alamofire/Alamofire.git", .upToNextMajor(from: "5.11.2"))`
321
- : `// .package(url: "https://github.com/Alamofire/Alamofire.git", .upToNextMajor(from: "5.11.2")) // Disabled via config (compileOnly)`,
322
- },
323
310
  {
324
311
  old: new RegExp(`${swiftCommentPrefix}\\.product\\(name:\\s*"FacebookCore",\\s*package:\\s*"facebook-ios-sdk"\\),${swiftTrailingComment}`),
325
312
  new: providerConfig.facebook === 'implementation'
@@ -338,12 +325,6 @@ function getPackageSwiftReplacements(providerConfig) {
338
325
  ? `.product(name: "GoogleSignIn", package: "GoogleSignIn-iOS"),`
339
326
  : `// .product(name: "GoogleSignIn", package: "GoogleSignIn-iOS"), // Disabled via config (compileOnly)`,
340
327
  },
341
- {
342
- old: new RegExp(`${swiftCommentPrefix}\\.product\\(name:\\s*"Alamofire",\\s*package:\\s*"Alamofire"\\)${swiftTrailingComment}`),
343
- new: providerConfig.apple === 'implementation'
344
- ? `.product(name: "Alamofire", package: "Alamofire")`
345
- : `// .product(name: "Alamofire", package: "Alamofire") // Disabled via config (compileOnly)`,
346
- },
347
328
  ];
348
329
  }
349
330
  /**