Skip to content

Commit a0dd695

Browse files
authored
Fix scope string format
According to the OAuth spec, the scopes have to be in a space separated string. Fixing this resolves failing Google login.
1 parent 9de2267 commit a0dd695

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

android/src/main/java/io/fullstack/oauth/OAuthManagerProviders.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,13 +264,13 @@ private static ServiceBuilder _oauth2ServiceBuilder(
264264
String scopes = "";
265265
if (cfg.containsKey("scopes")) {
266266
scopes = (String) cfg.get("scopes");
267-
String scopeStr = OAuthManagerProviders.getScopeString(scopes, ",");
267+
String scopeStr = OAuthManagerProviders.getScopeString(scopes, " ");
268268
builder.scope(scopeStr);
269269
}
270270

271271
if (opts != null && opts.hasKey("scopes")) {
272272
scopes = (String) opts.getString("scopes");
273-
String scopeStr = OAuthManagerProviders.getScopeString(scopes, ",");
273+
String scopeStr = OAuthManagerProviders.getScopeString(scopes, " ");
274274
builder.scope(scopeStr);
275275
}
276276

@@ -288,7 +288,7 @@ private static String getScopeString(
288288
final String scopes,
289289
final String joinBy
290290
) {
291-
List<String> array = Arrays.asList(scopes.replaceAll("\\s", "").split("[ ,]+"));
291+
List<String> array = Arrays.asList(scopes.replaceAll("\\s", "").split(","));
292292
Log.d(TAG, "array: " + array + " (" + array.size() + ") from " + scopes);
293293
return TextUtils.join(joinBy, array);
294294
}

0 commit comments

Comments
 (0)