Skip to content

Commit 2698287

Browse files
committed
Updating loginWithNativeSocialToken to call customTokenExchange internally
1 parent 64dee5e commit 2698287

File tree

2 files changed

+2
-11
lines changed

2 files changed

+2
-11
lines changed

auth0/src/main/java/com/auth0/android/authentication/AuthenticationAPIClient.kt

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -457,13 +457,7 @@ public class AuthenticationAPIClient @VisibleForTesting(otherwise = VisibleForTe
457457
* @return a request to configure and start that will yield [Credentials]
458458
*/
459459
public fun loginWithNativeSocialToken(token: String, tokenType: String): AuthenticationRequest {
460-
val parameters = ParameterBuilder.newAuthenticationBuilder()
461-
.setGrantType(ParameterBuilder.GRANT_TYPE_TOKEN_EXCHANGE)
462-
.setClientId(clientId)
463-
.set(SUBJECT_TOKEN_KEY, token)
464-
.set(SUBJECT_TOKEN_TYPE_KEY, tokenType)
465-
.asDictionary()
466-
return loginWithToken(parameters)
460+
return customTokenExchange(tokenType, token)
467461
}
468462

469463
/**
@@ -732,7 +726,7 @@ public class AuthenticationAPIClient @VisibleForTesting(otherwise = VisibleForTe
732726
subjectTokenType: String,
733727
subjectToken: String,
734728
): AuthenticationRequest {
735-
val parameters = ParameterBuilder.newBuilder()
729+
val parameters = ParameterBuilder.newAuthenticationBuilder()
736730
.setGrantType(ParameterBuilder.GRANT_TYPE_TOKEN_EXCHANGE)
737731
.set(SUBJECT_TOKEN_TYPE_KEY, subjectTokenType)
738732
.set(SUBJECT_TOKEN_KEY, subjectToken)

auth0/src/test/java/com/auth0/android/authentication/AuthenticationAPIClientTest.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2277,7 +2277,6 @@ public class AuthenticationAPIClientTest {
22772277
mockAPI.willReturnSuccessfulLogin()
22782278
val callback = MockAuthenticationCallback<Credentials>()
22792279
client.customTokenExchange( "subject-token-type","subject-token")
2280-
.setScope("openid profile email")
22812280
.start(callback)
22822281
ShadowLooper.idleMainLooper()
22832282
val request = mockAPI.takeRequest()
@@ -2308,7 +2307,6 @@ public class AuthenticationAPIClientTest {
23082307
mockAPI.willReturnSuccessfulLogin()
23092308
val credentials = client
23102309
.customTokenExchange("subject-token-type", "subject-token")
2311-
.setScope("openid profile email")
23122310
.execute()
23132311
val request = mockAPI.takeRequest()
23142312
assertThat(
@@ -2335,7 +2333,6 @@ public class AuthenticationAPIClientTest {
23352333
mockAPI.willReturnSuccessfulLogin()
23362334
val credentials = client
23372335
.customTokenExchange("subject-token-type", "subject-token")
2338-
.setScope("openid profile email")
23392336
.await()
23402337
val request = mockAPI.takeRequest()
23412338
assertThat(

0 commit comments

Comments
 (0)