From bddb662652fa14edef4290f1c136df96b6085dd0 Mon Sep 17 00:00:00 2001 From: Poovamraj T T Date: Mon, 17 Jul 2023 18:58:47 +0200 Subject: [PATCH] Revert changes from #654. Fix renew Credentials logic --- .../android/authentication/AuthenticationAPIClient.kt | 4 ++-- .../com/auth0/android/authentication/ParameterBuilder.kt | 6 ------ .../java/com/auth0/android/request/internal/OidcUtils.kt | 3 +-- .../authentication/AuthenticationAPIClientTest.kt | 9 +++------ 4 files changed, 6 insertions(+), 16 deletions(-) diff --git a/auth0/src/main/java/com/auth0/android/authentication/AuthenticationAPIClient.kt b/auth0/src/main/java/com/auth0/android/authentication/AuthenticationAPIClient.kt index 5a14a892..eeb144a1 100755 --- a/auth0/src/main/java/com/auth0/android/authentication/AuthenticationAPIClient.kt +++ b/auth0/src/main/java/com/auth0/android/authentication/AuthenticationAPIClient.kt @@ -555,7 +555,7 @@ public class AuthenticationAPIClient @VisibleForTesting(otherwise = VisibleForTe * @return a request to start */ public fun renewAuth(refreshToken: String): Request { - val parameters = ParameterBuilder.newBuilderWithRequiredScope() + val parameters = ParameterBuilder.newBuilder() .setClientId(clientId) .setRefreshToken(refreshToken) .setGrantType(ParameterBuilder.GRANT_TYPE_REFRESH_TOKEN) @@ -690,7 +690,7 @@ public class AuthenticationAPIClient @VisibleForTesting(otherwise = VisibleForTe codeVerifier: String, redirectUri: String ): Request { - val parameters = ParameterBuilder.newBuilderWithRequiredScope() + val parameters = ParameterBuilder.newBuilder() .setClientId(clientId) .setGrantType(ParameterBuilder.GRANT_TYPE_AUTHORIZATION_CODE) .set(OAUTH_CODE_KEY, authorizationCode) diff --git a/auth0/src/main/java/com/auth0/android/authentication/ParameterBuilder.kt b/auth0/src/main/java/com/auth0/android/authentication/ParameterBuilder.kt index 91a82a23..3364e111 100755 --- a/auth0/src/main/java/com/auth0/android/authentication/ParameterBuilder.kt +++ b/auth0/src/main/java/com/auth0/android/authentication/ParameterBuilder.kt @@ -181,12 +181,6 @@ public class ParameterBuilder private constructor(parameters: Map(request) - assertThat(body, Matchers.hasEntry("scope", OidcUtils.REQUIRED_SCOPE)) + assertThat(body, Matchers.not(Matchers.hasKey("scope"))) assertThat(body, Matchers.hasEntry("client_id", CLIENT_ID)) assertThat(body, Matchers.hasEntry("refresh_token", "refreshToken")) assertThat(body, Matchers.hasEntry("grant_type", "refresh_token")) @@ -2230,7 +2229,7 @@ public class AuthenticationAPIClientTest { assertThat(body, Matchers.hasEntry("client_id", CLIENT_ID)) assertThat(body, Matchers.hasEntry("refresh_token", "refreshToken")) assertThat(body, Matchers.hasEntry("grant_type", "refresh_token")) - assertThat(body, Matchers.hasEntry("scope", OidcUtils.REQUIRED_SCOPE)) + assertThat(body, Matchers.not(Matchers.hasKey("scope"))) assertThat(credentials, Matchers.`is`(Matchers.notNullValue())) } @@ -2253,7 +2252,7 @@ public class AuthenticationAPIClientTest { assertThat(body, Matchers.hasEntry("client_id", CLIENT_ID)) assertThat(body, Matchers.hasEntry("refresh_token", "refreshToken")) assertThat(body, Matchers.hasEntry("grant_type", "refresh_token")) - assertThat(body, Matchers.hasEntry("scope", OidcUtils.REQUIRED_SCOPE)) + assertThat(body, Matchers.not(Matchers.hasKey("scope"))) assertThat(credentials, Matchers.`is`(Matchers.notNullValue())) } @@ -2364,7 +2363,6 @@ public class AuthenticationAPIClientTest { assertThat(body, Matchers.hasEntry("code", "code")) assertThat(body, Matchers.hasEntry("code_verifier", "codeVerifier")) assertThat(body, Matchers.hasEntry("redirect_uri", "http://redirect.uri")) - assertThat(body, Matchers.hasEntry("scope", OidcUtils.REQUIRED_SCOPE)) assertThat( callback, AuthenticationCallbackMatcher.hasPayloadOfType( Credentials::class.java @@ -2390,7 +2388,6 @@ public class AuthenticationAPIClientTest { assertThat(body, Matchers.hasEntry("code", "code")) assertThat(body, Matchers.hasEntry("code_verifier", "codeVerifier")) assertThat(body, Matchers.hasEntry("redirect_uri", "http://redirect.uri")) - assertThat(body, Matchers.hasEntry("scope", OidcUtils.REQUIRED_SCOPE)) assertThat( callback, AuthenticationCallbackMatcher.hasError( Credentials::class.java