Skip to content

Commit a7aa6ac

Browse files
committed
refactor to use common method to exchange token
1 parent 90cf5c0 commit a7aa6ac

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

firebase-auth-rest/core/src/main/java/com/anotherdev/firebase/auth/rest/RestAuthProvider.java

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -276,17 +276,8 @@ public Task<GetTokenResult> getAccessToken(boolean forceRefresh) {
276276
source.trySetException(new FirebaseException("Current refresh token is null. Log out"));
277277
signOut();
278278
} else {
279-
ExchangeTokenRequest request = ExchangeTokenRequest.builder()
280-
.refreshToken(currentRefreshToken)
281-
.build();
282-
283279
//noinspection ResultOfMethodCallIgnored
284-
RestAuthApi.token()
285-
.exchangeToken(request)
286-
.map(response -> {
287-
saveCurrentUser(response.getIdToken(), response.getRefreshToken());
288-
return response;
289-
})
280+
exchangeToken(user)
290281
.doOnSuccess(response -> source.trySetResult(getTokenResultLocal(user)))
291282
.doOnError(e -> source.trySetException(new Exception(e)))
292283
.subscribe(Functions.emptyConsumer(), RxUtil.ON_ERROR_LOG_V3);

0 commit comments

Comments
 (0)