@capgo/capacitor-social-login 8.7.4 → 8.7.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.
- package/android/build.gradle +1 -2
- package/android/consumer-proguard-rules.pro +0 -9
- package/android/src/main/java/ee/forgr/capacitor/social/login/AppleProvider.java +56 -70
- package/android/src/main/java/ee/forgr/capacitor/social/login/GoogleProvider.java +91 -98
- package/android/src/main/java/ee/forgr/capacitor/social/login/OAuth2Provider.java +155 -171
- package/android/src/main/java/ee/forgr/capacitor/social/login/SocialLoginPlugin.java +55 -6
- package/android/src/main/java/ee/forgr/capacitor/social/login/TwitterProvider.java +98 -110
- package/android/src/main/java/ee/forgr/capacitor/social/login/helpers/DependencyAvailabilityChecker.java +4 -28
- package/android/src/main/java/ee/forgr/capacitor/social/login/helpers/PluginHttpClient.java +430 -0
- package/ios/Sources/SocialLoginPlugin/SocialLoginPlugin.swift +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,430 @@
|
|
|
1
|
+
package ee.forgr.capacitor.social.login.helpers;
|
|
2
|
+
|
|
3
|
+
import java.io.BufferedReader;
|
|
4
|
+
import java.io.IOException;
|
|
5
|
+
import java.io.InputStream;
|
|
6
|
+
import java.io.InputStreamReader;
|
|
7
|
+
import java.io.OutputStream;
|
|
8
|
+
import java.net.HttpURLConnection;
|
|
9
|
+
import java.net.SocketTimeoutException;
|
|
10
|
+
import java.net.URL;
|
|
11
|
+
import java.net.URLEncoder;
|
|
12
|
+
import java.nio.charset.StandardCharsets;
|
|
13
|
+
import java.util.HashMap;
|
|
14
|
+
import java.util.Map;
|
|
15
|
+
import java.util.concurrent.ExecutorService;
|
|
16
|
+
import java.util.concurrent.Executors;
|
|
17
|
+
import java.util.concurrent.atomic.AtomicReference;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Minimal async HTTP client using {@link HttpURLConnection} (replaces OkHttp for plugin HTTP calls).
|
|
21
|
+
*/
|
|
22
|
+
public final class PluginHttpClient {
|
|
23
|
+
|
|
24
|
+
private static final int EXECUTOR_THREADS = 4;
|
|
25
|
+
private static final int MAX_REDIRECT_HOPS = 5;
|
|
26
|
+
|
|
27
|
+
public static final PluginHttpClient DEFAULT = new PluginHttpClient(10_000, 10_000, 10_000);
|
|
28
|
+
public static final PluginHttpClient THIRTY_SECOND_TIMEOUTS = new PluginHttpClient(30_000, 30_000, 30_000);
|
|
29
|
+
|
|
30
|
+
private static final ExecutorService EXECUTOR = Executors.newFixedThreadPool(EXECUTOR_THREADS);
|
|
31
|
+
|
|
32
|
+
private final int connectTimeoutMs;
|
|
33
|
+
private final int readTimeoutMs;
|
|
34
|
+
private final int writeTimeoutMs;
|
|
35
|
+
|
|
36
|
+
public PluginHttpClient(int connectTimeoutMs, int readTimeoutMs, int writeTimeoutMs) {
|
|
37
|
+
this.connectTimeoutMs = connectTimeoutMs;
|
|
38
|
+
this.readTimeoutMs = readTimeoutMs;
|
|
39
|
+
this.writeTimeoutMs = writeTimeoutMs;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
public interface Callback {
|
|
43
|
+
void onFailure(IOException e);
|
|
44
|
+
|
|
45
|
+
void onResponse(int code, String body) throws IOException;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
public void enqueueGet(String url, Map<String, String> headers, Callback callback) {
|
|
49
|
+
enqueue("GET", url, null, headers, callback);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
public void enqueuePostForm(String url, Map<String, String> formFields, Map<String, String> headers, Callback callback) {
|
|
53
|
+
enqueue("POST", url, formFields, headers, callback);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
int requestDeadlineMs() {
|
|
57
|
+
return connectTimeoutMs + writeTimeoutMs + readTimeoutMs;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
private void enqueue(String method, String url, Map<String, String> formFields, Map<String, String> headers, Callback callback) {
|
|
61
|
+
EXECUTOR.execute(() -> {
|
|
62
|
+
final int requestDeadlineMs = requestDeadlineMs();
|
|
63
|
+
final AtomicReference<HttpURLConnection> connectionRef = new AtomicReference<>();
|
|
64
|
+
final int[] responseCode = new int[1];
|
|
65
|
+
final String[] responseBody = new String[1];
|
|
66
|
+
final IOException[] error = new IOException[1];
|
|
67
|
+
|
|
68
|
+
Thread worker = new Thread(
|
|
69
|
+
() -> {
|
|
70
|
+
try {
|
|
71
|
+
ExchangeResult result;
|
|
72
|
+
if ("POST".equals(method) && formFields != null) {
|
|
73
|
+
result = performPostFormExchange(url, formFields, headers, connectionRef);
|
|
74
|
+
} else {
|
|
75
|
+
result = performGetExchange(url, headers, connectionRef);
|
|
76
|
+
}
|
|
77
|
+
responseCode[0] = result.code;
|
|
78
|
+
responseBody[0] = result.body;
|
|
79
|
+
} catch (IOException e) {
|
|
80
|
+
error[0] = e;
|
|
81
|
+
} catch (RuntimeException e) {
|
|
82
|
+
error[0] = new IOException(e);
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
"PluginHttpClient-request"
|
|
86
|
+
);
|
|
87
|
+
worker.start();
|
|
88
|
+
try {
|
|
89
|
+
worker.join(requestDeadlineMs);
|
|
90
|
+
} catch (InterruptedException e) {
|
|
91
|
+
Thread.currentThread().interrupt();
|
|
92
|
+
HttpURLConnection connection = connectionRef.get();
|
|
93
|
+
if (connection != null) {
|
|
94
|
+
connection.disconnect();
|
|
95
|
+
}
|
|
96
|
+
worker.interrupt();
|
|
97
|
+
callback.onFailure(new IOException("Request interrupted", e));
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
if (worker.isAlive()) {
|
|
101
|
+
worker.interrupt();
|
|
102
|
+
HttpURLConnection connection = connectionRef.get();
|
|
103
|
+
if (connection != null) {
|
|
104
|
+
connection.disconnect();
|
|
105
|
+
}
|
|
106
|
+
callback.onFailure(new SocketTimeoutException("Request timed out after " + requestDeadlineMs + "ms"));
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
if (error[0] != null) {
|
|
110
|
+
callback.onFailure(error[0]);
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
try {
|
|
114
|
+
callback.onResponse(responseCode[0], responseBody[0]);
|
|
115
|
+
} catch (IOException e) {
|
|
116
|
+
callback.onFailure(e);
|
|
117
|
+
} catch (RuntimeException e) {
|
|
118
|
+
callback.onFailure(new IOException(e));
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
private static final class ExchangeResult {
|
|
124
|
+
|
|
125
|
+
final int code;
|
|
126
|
+
final String body;
|
|
127
|
+
|
|
128
|
+
ExchangeResult(int code, String body) {
|
|
129
|
+
this.code = code;
|
|
130
|
+
this.body = body;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
private ExchangeResult performPostFormExchange(
|
|
135
|
+
String urlString,
|
|
136
|
+
Map<String, String> formFields,
|
|
137
|
+
Map<String, String> headers,
|
|
138
|
+
AtomicReference<HttpURLConnection> connectionRef
|
|
139
|
+
) throws IOException {
|
|
140
|
+
URL originalUrl = new URL(urlString);
|
|
141
|
+
byte[] body = encodeFormBody(formFields);
|
|
142
|
+
String currentUrl = urlString;
|
|
143
|
+
|
|
144
|
+
for (int hop = 0; hop <= MAX_REDIRECT_HOPS; hop++) {
|
|
145
|
+
HttpURLConnection connection = createPostFormConnection(currentUrl, body, headers);
|
|
146
|
+
connectionRef.set(connection);
|
|
147
|
+
try {
|
|
148
|
+
writePostFormBody(connection, body);
|
|
149
|
+
int code = connection.getResponseCode();
|
|
150
|
+
if (isRedirectStatus(code) && hop < MAX_REDIRECT_HOPS) {
|
|
151
|
+
String location = connection.getHeaderField("Location");
|
|
152
|
+
if (location == null || location.isEmpty()) {
|
|
153
|
+
return new ExchangeResult(code, readBody(connection, code));
|
|
154
|
+
}
|
|
155
|
+
URL destination = resolveRedirectUrl(new URL(currentUrl), location);
|
|
156
|
+
if (!isSafeRedirectDestination(originalUrl, destination)) {
|
|
157
|
+
throw new IOException("Refusing redirect to unsafe destination: " + destination);
|
|
158
|
+
}
|
|
159
|
+
if (code != 307 && code != 308) {
|
|
160
|
+
throw new IOException("POST form request cannot follow HTTP " + code + " redirect without losing credentials");
|
|
161
|
+
}
|
|
162
|
+
currentUrl = destination.toString();
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
return new ExchangeResult(code, readBody(connection, code));
|
|
166
|
+
} finally {
|
|
167
|
+
connection.disconnect();
|
|
168
|
+
clearConnectionRef(connectionRef, connection);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
throw new IOException("Too many HTTP redirects (max " + MAX_REDIRECT_HOPS + ")");
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
private ExchangeResult performGetExchange(
|
|
175
|
+
String urlString,
|
|
176
|
+
Map<String, String> headers,
|
|
177
|
+
AtomicReference<HttpURLConnection> connectionRef
|
|
178
|
+
) throws IOException {
|
|
179
|
+
URL originalUrl = new URL(urlString);
|
|
180
|
+
String currentUrl = urlString;
|
|
181
|
+
Map<String, String> currentHeaders = headers;
|
|
182
|
+
|
|
183
|
+
for (int hop = 0; hop <= MAX_REDIRECT_HOPS; hop++) {
|
|
184
|
+
HttpURLConnection connection = openGetConnection(currentUrl, currentHeaders);
|
|
185
|
+
connectionRef.set(connection);
|
|
186
|
+
try {
|
|
187
|
+
int code = connection.getResponseCode();
|
|
188
|
+
if (isRedirectStatus(code) && hop < MAX_REDIRECT_HOPS) {
|
|
189
|
+
String location = connection.getHeaderField("Location");
|
|
190
|
+
if (location == null || location.isEmpty()) {
|
|
191
|
+
return new ExchangeResult(code, readBody(connection, code));
|
|
192
|
+
}
|
|
193
|
+
URL destination = resolveRedirectUrl(new URL(currentUrl), location);
|
|
194
|
+
if (!isSafeGetRedirectDestination(originalUrl, destination)) {
|
|
195
|
+
throw new IOException("Refusing redirect to unsafe destination: " + destination);
|
|
196
|
+
}
|
|
197
|
+
currentUrl = destination.toString();
|
|
198
|
+
if (redirectChangesEffectiveOrigin(originalUrl, destination)) {
|
|
199
|
+
currentHeaders = headersWithoutAuthorization(headers);
|
|
200
|
+
}
|
|
201
|
+
continue;
|
|
202
|
+
}
|
|
203
|
+
return new ExchangeResult(code, readBody(connection, code));
|
|
204
|
+
} finally {
|
|
205
|
+
connection.disconnect();
|
|
206
|
+
clearConnectionRef(connectionRef, connection);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
throw new IOException("Too many HTTP redirects (max " + MAX_REDIRECT_HOPS + ")");
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
private static void clearConnectionRef(AtomicReference<HttpURLConnection> connectionRef, HttpURLConnection connection) {
|
|
213
|
+
if (connectionRef.get() == connection) {
|
|
214
|
+
connectionRef.set(null);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
private static Map<String, String> headersWithoutAuthorization(Map<String, String> headers) {
|
|
219
|
+
if (headers == null || headers.isEmpty()) {
|
|
220
|
+
return headers;
|
|
221
|
+
}
|
|
222
|
+
Map<String, String> filtered = new HashMap<>();
|
|
223
|
+
for (Map.Entry<String, String> entry : headers.entrySet()) {
|
|
224
|
+
if (entry.getKey() != null && entry.getKey().equalsIgnoreCase("Authorization")) {
|
|
225
|
+
continue;
|
|
226
|
+
}
|
|
227
|
+
filtered.put(entry.getKey(), entry.getValue());
|
|
228
|
+
}
|
|
229
|
+
return filtered;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
static boolean isRedirectStatus(int code) {
|
|
233
|
+
return (
|
|
234
|
+
code == HttpURLConnection.HTTP_MOVED_PERM ||
|
|
235
|
+
code == HttpURLConnection.HTTP_MOVED_TEMP ||
|
|
236
|
+
code == 303 ||
|
|
237
|
+
code == 307 ||
|
|
238
|
+
code == 308
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
static URL resolveRedirectUrl(URL base, String location) throws IOException {
|
|
243
|
+
return new URL(base, location);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* OAuth form posts must not follow redirects to a different host or downgrade HTTPS.
|
|
248
|
+
*/
|
|
249
|
+
static boolean isSafeRedirectDestination(URL original, URL destination) {
|
|
250
|
+
if (destination == null) {
|
|
251
|
+
return false;
|
|
252
|
+
}
|
|
253
|
+
if (destination.getUserInfo() != null) {
|
|
254
|
+
return false;
|
|
255
|
+
}
|
|
256
|
+
String originalHost = original.getHost();
|
|
257
|
+
String destinationHost = destination.getHost();
|
|
258
|
+
if (originalHost == null || destinationHost == null || originalHost.isEmpty() || destinationHost.isEmpty()) {
|
|
259
|
+
return false;
|
|
260
|
+
}
|
|
261
|
+
if (!originalHost.equalsIgnoreCase(destinationHost)) {
|
|
262
|
+
return false;
|
|
263
|
+
}
|
|
264
|
+
if ("https".equalsIgnoreCase(original.getProtocol()) && !"https".equalsIgnoreCase(destination.getProtocol())) {
|
|
265
|
+
return false;
|
|
266
|
+
}
|
|
267
|
+
return true;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* GET requests may follow cross-host redirects (OIDC discovery, tokeninfo) but must not downgrade HTTPS.
|
|
272
|
+
*/
|
|
273
|
+
static boolean isSafeGetRedirectDestination(URL original, URL destination) {
|
|
274
|
+
if (destination == null || destination.getUserInfo() != null) {
|
|
275
|
+
return false;
|
|
276
|
+
}
|
|
277
|
+
String host = destination.getHost();
|
|
278
|
+
if (host == null || host.isEmpty()) {
|
|
279
|
+
return false;
|
|
280
|
+
}
|
|
281
|
+
return !("https".equalsIgnoreCase(original.getProtocol()) && !"https".equalsIgnoreCase(destination.getProtocol()));
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
static int effectivePort(URL url) {
|
|
285
|
+
return url.getPort() != -1 ? url.getPort() : url.getDefaultPort();
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
static boolean redirectChangesEffectiveOrigin(URL original, URL destination) {
|
|
289
|
+
if (original.getHost() == null || destination.getHost() == null) {
|
|
290
|
+
return true;
|
|
291
|
+
}
|
|
292
|
+
return (
|
|
293
|
+
!original.getProtocol().equalsIgnoreCase(destination.getProtocol()) ||
|
|
294
|
+
!original.getHost().equalsIgnoreCase(destination.getHost()) ||
|
|
295
|
+
effectivePort(original) != effectivePort(destination)
|
|
296
|
+
);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
private HttpURLConnection createPostFormConnection(String urlString, byte[] body, Map<String, String> headers) throws IOException {
|
|
300
|
+
HttpURLConnection connection = (HttpURLConnection) new URL(urlString).openConnection();
|
|
301
|
+
connection.setInstanceFollowRedirects(false);
|
|
302
|
+
connection.setConnectTimeout(connectTimeoutMs);
|
|
303
|
+
connection.setReadTimeout(readTimeoutMs);
|
|
304
|
+
connection.setRequestMethod("POST");
|
|
305
|
+
connection.setUseCaches(false);
|
|
306
|
+
if (headers != null) {
|
|
307
|
+
for (Map.Entry<String, String> entry : headers.entrySet()) {
|
|
308
|
+
connection.setRequestProperty(entry.getKey(), entry.getValue());
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
connection.setDoOutput(true);
|
|
312
|
+
connection.setFixedLengthStreamingMode(body.length);
|
|
313
|
+
if (headers == null || !containsHeaderIgnoreCase(headers, "Content-Type")) {
|
|
314
|
+
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
|
|
315
|
+
}
|
|
316
|
+
return connection;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
private void writePostFormBody(HttpURLConnection connection, byte[] body) throws IOException {
|
|
320
|
+
try (OutputStream out = connection.getOutputStream()) {
|
|
321
|
+
writeBodyWithTimeout(out, body, writeTimeoutMs, connection);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
private HttpURLConnection openGetConnection(String urlString, Map<String, String> headers) throws IOException {
|
|
326
|
+
HttpURLConnection connection = (HttpURLConnection) new URL(urlString).openConnection();
|
|
327
|
+
connection.setInstanceFollowRedirects(false);
|
|
328
|
+
connection.setConnectTimeout(connectTimeoutMs);
|
|
329
|
+
connection.setReadTimeout(readTimeoutMs);
|
|
330
|
+
connection.setRequestMethod("GET");
|
|
331
|
+
connection.setUseCaches(false);
|
|
332
|
+
if (headers != null) {
|
|
333
|
+
for (Map.Entry<String, String> entry : headers.entrySet()) {
|
|
334
|
+
connection.setRequestProperty(entry.getKey(), entry.getValue());
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
return connection;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* HttpURLConnection has no write timeout on Android; run the body write on a worker thread and bound wait time.
|
|
342
|
+
*/
|
|
343
|
+
static void writeBodyWithTimeout(OutputStream out, byte[] body, int writeTimeoutMs, HttpURLConnection connection) throws IOException {
|
|
344
|
+
if (writeTimeoutMs <= 0) {
|
|
345
|
+
out.write(body);
|
|
346
|
+
out.flush();
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
final IOException[] writeError = new IOException[1];
|
|
351
|
+
Thread writeThread = new Thread(
|
|
352
|
+
() -> {
|
|
353
|
+
try {
|
|
354
|
+
out.write(body);
|
|
355
|
+
out.flush();
|
|
356
|
+
} catch (IOException e) {
|
|
357
|
+
writeError[0] = e;
|
|
358
|
+
}
|
|
359
|
+
},
|
|
360
|
+
"PluginHttpClient-write"
|
|
361
|
+
);
|
|
362
|
+
writeThread.start();
|
|
363
|
+
try {
|
|
364
|
+
writeThread.join(writeTimeoutMs);
|
|
365
|
+
} catch (InterruptedException e) {
|
|
366
|
+
Thread.currentThread().interrupt();
|
|
367
|
+
if (connection != null) {
|
|
368
|
+
connection.disconnect();
|
|
369
|
+
}
|
|
370
|
+
throw new IOException("Request body write interrupted", e);
|
|
371
|
+
}
|
|
372
|
+
if (writeThread.isAlive()) {
|
|
373
|
+
writeThread.interrupt();
|
|
374
|
+
if (connection != null) {
|
|
375
|
+
connection.disconnect();
|
|
376
|
+
}
|
|
377
|
+
try {
|
|
378
|
+
writeThread.join(1_000);
|
|
379
|
+
} catch (InterruptedException e) {
|
|
380
|
+
Thread.currentThread().interrupt();
|
|
381
|
+
}
|
|
382
|
+
throw new SocketTimeoutException("Request body write timed out after " + writeTimeoutMs + "ms");
|
|
383
|
+
}
|
|
384
|
+
if (writeError[0] != null) {
|
|
385
|
+
throw writeError[0];
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
private static boolean containsHeaderIgnoreCase(Map<String, String> headers, String name) {
|
|
390
|
+
for (String key : headers.keySet()) {
|
|
391
|
+
if (key != null && key.equalsIgnoreCase(name)) {
|
|
392
|
+
return true;
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
return false;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
static byte[] encodeFormBody(Map<String, String> formFields) throws IOException {
|
|
399
|
+
StringBuilder encoded = new StringBuilder();
|
|
400
|
+
for (Map.Entry<String, String> entry : formFields.entrySet()) {
|
|
401
|
+
if (encoded.length() > 0) {
|
|
402
|
+
encoded.append('&');
|
|
403
|
+
}
|
|
404
|
+
encoded.append(URLEncoder.encode(entry.getKey(), StandardCharsets.UTF_8.name()));
|
|
405
|
+
encoded.append('=');
|
|
406
|
+
encoded.append(URLEncoder.encode(entry.getValue() != null ? entry.getValue() : "", StandardCharsets.UTF_8.name()));
|
|
407
|
+
}
|
|
408
|
+
return encoded.toString().getBytes(StandardCharsets.UTF_8);
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
private static String readBody(HttpURLConnection connection, int code) throws IOException {
|
|
412
|
+
InputStream stream = code >= 200 && code < 300 ? connection.getInputStream() : connection.getErrorStream();
|
|
413
|
+
if (stream == null) {
|
|
414
|
+
return "";
|
|
415
|
+
}
|
|
416
|
+
try (BufferedReader reader = new BufferedReader(new InputStreamReader(stream, StandardCharsets.UTF_8))) {
|
|
417
|
+
StringBuilder sb = new StringBuilder();
|
|
418
|
+
char[] buffer = new char[4096];
|
|
419
|
+
int read;
|
|
420
|
+
while ((read = reader.read(buffer)) != -1) {
|
|
421
|
+
sb.append(buffer, 0, read);
|
|
422
|
+
}
|
|
423
|
+
return sb.toString();
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
public static boolean isSuccessfulHttpCode(int code) {
|
|
428
|
+
return code >= 200 && code < 300;
|
|
429
|
+
}
|
|
430
|
+
}
|
|
@@ -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.5"
|
|
20
20
|
public let identifier = "SocialLoginPlugin"
|
|
21
21
|
public let jsName = "SocialLogin"
|
|
22
22
|
private static let userCancelledCode = "USER_CANCELLED"
|