Skip to content

Commit

Permalink
Merge 31c4498 into 9a931d8
Browse files Browse the repository at this point in the history
  • Loading branch information
quentin-fox authored Dec 31, 2021
2 parents 9a931d8 + 31c4498 commit 1def9c3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ public void getToken(String appName, boolean forceRefresh, Promise promise) {
getExecutor(),
(task) -> {
if (task.isSuccessful()) {
promise.resolve(task.getResult().getToken());
WritableMap tokenResultMap = Arguments.createMap();
tokenResultMap.putString("token", task.getResult().getToken());
promise.resolve(tokenResultMap);
} else {
Log.e(
TAG,
Expand Down
4 changes: 2 additions & 2 deletions packages/app-check/e2e/appcheck.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe('appCheck()', function () {
describe('getToken())', function () {
it('token fetch attempt should work', async function () {
// Our tests configure a debug provider with shared secret so we should get a valid token
const token = await firebase.appCheck().getToken();
const { token } = await firebase.appCheck().getToken();
token.should.not.equal('');
const decodedToken = jwt.decode(token);
decodedToken.aud[1].should.equal('projects/react-native-firebase-testing');
Expand All @@ -53,7 +53,7 @@ describe('appCheck()', function () {

// Force refresh should get a different token?
// TODO sometimes fails on android https://github.com/firebase/firebase-android-sdk/issues/2954
const token2 = await firebase.appCheck().getToken(true);
const { token: token2 } = await firebase.appCheck().getToken(true);
token2.should.not.equal('');
const decodedToken2 = jwt.decode(token2);
decodedToken2.aud[1].should.equal('projects/react-native-firebase-testing');
Expand Down
4 changes: 3 additions & 1 deletion packages/app-check/ios/RNFBAppCheck/RNFBAppCheckModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ - (dispatch_queue_t)methodQueue {
return;
}

resolve(token.token);
NSMutableDictionary *tokenResultDictionary = [NSMutableDictionary new];
tokenResultDictionary[@"token"] = token.token;
resolve(tokenResultDictionary);
}];
}

Expand Down

0 comments on commit 1def9c3

Please sign in to comment.