@capgo/capacitor-social-login 8.5.0 → 8.5.1

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.
@@ -151,18 +151,18 @@ public class AppleProvider implements SocialProvider {
151
151
  return;
152
152
  }
153
153
 
154
- // Save the call reference immediately so it's always available
154
+ boolean useBroadcastChannel = config.optBoolean("useBroadcastChannel", this.useBroadcastChannel);
155
+ if (SocialLoginPlugin.shouldRejectMissingAppleRedirectUrl(this.redirectUrl, useBroadcastChannel)) {
156
+ call.reject("apple.android.redirectUrl is null or empty");
157
+ return;
158
+ }
159
+
155
160
  this.lastcall = call;
156
161
  call.setKeepAlive(true);
157
162
 
158
- // Check if Broadcast Channel is enabled
159
- boolean useBroadcastChannel = config.optBoolean("useBroadcastChannel", this.useBroadcastChannel);
160
-
161
163
  if (useBroadcastChannel) {
162
- // Use Broadcast Channel approach - simplified flow
163
164
  loginWithBroadcastChannel(call, config);
164
165
  } else {
165
- // Use traditional URL redirect approach
166
166
  loginWithRedirect(call, config);
167
167
  }
168
168
  }
@@ -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.0";
27
+ private final String pluginVersion = "8.5.1";
28
28
 
29
29
  public static String LOG_TAG = "CapgoSocialLogin";
30
30
  public HashMap<String, SocialProvider> socialProviderHashMap = new HashMap<>();
@@ -49,12 +49,6 @@ public class SocialLoginPlugin extends Plugin {
49
49
  return;
50
50
  }
51
51
 
52
- String androidAppleRedirect = apple.getString("redirectUrl");
53
- if (androidAppleRedirect == null || androidAppleRedirect.isEmpty()) {
54
- call.reject("apple.android.redirectUrl is null or empty");
55
- return;
56
- }
57
-
58
52
  String androidAppleClientId = apple.getString("clientId");
59
53
  if (androidAppleClientId == null || androidAppleClientId.isEmpty()) {
60
54
  call.reject("apple.android.clientId is null or empty");
@@ -63,6 +57,11 @@ public class SocialLoginPlugin extends Plugin {
63
57
 
64
58
  boolean useProperTokenExchange = apple.has("useProperTokenExchange") ? apple.getBool("useProperTokenExchange") : false;
65
59
  boolean useBroadcastChannel = apple.has("useBroadcastChannel") ? apple.getBool("useBroadcastChannel") : false;
60
+ String androidAppleRedirect = apple.getString("redirectUrl");
61
+ if (shouldRejectMissingAppleRedirectUrl(androidAppleRedirect, useBroadcastChannel)) {
62
+ call.reject("apple.android.redirectUrl is null or empty");
63
+ return;
64
+ }
66
65
 
67
66
  AppleProvider appleProvider = new AppleProvider(
68
67
  androidAppleRedirect,
@@ -206,6 +205,10 @@ public class SocialLoginPlugin extends Plugin {
206
205
  call.resolve();
207
206
  }
208
207
 
208
+ static boolean shouldRejectMissingAppleRedirectUrl(String redirectUrl, boolean useBroadcastChannel) {
209
+ return !useBroadcastChannel && (redirectUrl == null || redirectUrl.isEmpty());
210
+ }
211
+
209
212
  @PluginMethod
210
213
  public void login(PluginCall call) {
211
214
  String providerStr = call.getString("provider", "");
@@ -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.0"
19
+ private let pluginVersion: String = "8.5.1"
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.0",
3
+ "version": "8.5.1",
4
4
  "description": "All social logins in one plugin",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",