diff --git a/auth0/src/main/java/com/auth0/android/provider/WebAuthProvider.java b/auth0/src/main/java/com/auth0/android/provider/WebAuthProvider.java index 7d91c8941..ebfd00937 100644 --- a/auth0/src/main/java/com/auth0/android/provider/WebAuthProvider.java +++ b/auth0/src/main/java/com/auth0/android/provider/WebAuthProvider.java @@ -183,7 +183,7 @@ public Builder withScope(@NonNull String scope) { public Builder withConnectionScope(@NonNull String... connectionScope) { StringBuilder sb = new StringBuilder(); for (String s : connectionScope) { - sb.append(s.trim()).append(" "); + sb.append(s.trim()).append(","); } if (sb.length() > 0) { sb.deleteCharAt(sb.length() - 1); diff --git a/auth0/src/test/java/com/auth0/android/provider/WebAuthProviderTest.java b/auth0/src/test/java/com/auth0/android/provider/WebAuthProviderTest.java index 3ef2aa67e..0f8f36578 100644 --- a/auth0/src/test/java/com/auth0/android/provider/WebAuthProviderTest.java +++ b/auth0/src/test/java/com/auth0/android/provider/WebAuthProviderTest.java @@ -407,9 +407,9 @@ public void shouldNotHaveDefaultConnectionScope() throws Exception { @Test public void shouldSetConnectionScopeFromParameters() throws Exception { - Map parameters = Collections.singletonMap("connection_scope", (Object) "openid email contacts"); + Map parameters = Collections.singletonMap("connection_scope", (Object) "openid,email,contacts"); WebAuthProvider.init(account) - .withConnectionScope("profile super_scope") + .withConnectionScope("profile", "super_scope") .withParameters(parameters) .start(activity, callback); @@ -417,27 +417,27 @@ public void shouldSetConnectionScopeFromParameters() throws Exception { Uri uri = intentCaptor.getValue().getParcelableExtra(AuthenticationActivity.EXTRA_AUTHORIZE_URI); assertThat(uri, is(notNullValue())); - assertThat(uri, hasParamWithValue("connection_scope", "openid email contacts")); + assertThat(uri, hasParamWithValue("connection_scope", "openid,email,contacts")); } @Test public void shouldSetConnectionScopeFromSetter() throws Exception { - Map parameters = Collections.singletonMap("connection_scope", (Object) "openid email contacts"); + Map parameters = Collections.singletonMap("connection_scope", (Object) "openid,email,contacts"); WebAuthProvider.init(account) .withParameters(parameters) - .withConnectionScope("profile super_scope") + .withConnectionScope("profile", "super_scope") .start(activity, callback); verify(activity).startActivity(intentCaptor.capture()); Uri uri = intentCaptor.getValue().getParcelableExtra(AuthenticationActivity.EXTRA_AUTHORIZE_URI); assertThat(uri, is(notNullValue())); - assertThat(uri, hasParamWithValue("connection_scope", "profile super_scope")); + assertThat(uri, hasParamWithValue("connection_scope", "profile,super_scope")); } @Test public void shouldNotOverrideConnectionScopeValueWithDefaultConnectionScope() throws Exception { - Map parameters = Collections.singletonMap("connection_scope", (Object) "openid email contacts"); + Map parameters = Collections.singletonMap("connection_scope", (Object) "openid,email,contacts"); WebAuthProvider.init(account) .withParameters(parameters) .start(activity, callback); @@ -446,7 +446,7 @@ public void shouldNotOverrideConnectionScopeValueWithDefaultConnectionScope() th Uri uri = intentCaptor.getValue().getParcelableExtra(AuthenticationActivity.EXTRA_AUTHORIZE_URI); assertThat(uri, is(notNullValue())); - assertThat(uri, hasParamWithValue("connection_scope", "openid email contacts")); + assertThat(uri, hasParamWithValue("connection_scope", "openid,email,contacts")); } @Test @@ -459,7 +459,7 @@ public void shouldSetConnectionScope() throws Exception { Uri uri = intentCaptor.getValue().getParcelableExtra(AuthenticationActivity.EXTRA_AUTHORIZE_URI); assertThat(uri, is(notNullValue())); - assertThat(uri, hasParamWithValue("connection_scope", "the scope of my connection")); + assertThat(uri, hasParamWithValue("connection_scope", "the,scope,of,my,connection")); }