Skip to content

Commit

Permalink
fix: pass through GetIdTokenOptions to firebase web currentUser.getId…
Browse files Browse the repository at this point in the history
…Token
  • Loading branch information
meds committed May 15, 2022
1 parent 97bd1b1 commit 99d7fcc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/hip-flies-arrive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@capacitor-firebase/authentication": minor
---

Pass through force refresh to firebase
5 changes: 3 additions & 2 deletions packages/authentication/src/web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import type {
CreateUserWithEmailAndPasswordOptions,
FirebaseAuthenticationPlugin,
GetCurrentUserResult,
GetIdTokenOptions,
GetIdTokenResult,
SendPasswordResetEmailOptions,
SetLanguageCodeOptions,
Expand Down Expand Up @@ -88,12 +89,12 @@ export class FirebaseAuthenticationWeb
return result;
}

public async getIdToken(): Promise<GetIdTokenResult> {
public async getIdToken(options?: GetIdTokenOptions): Promise<GetIdTokenResult> {
const auth = getAuth();
if (!auth.currentUser) {
throw new Error(FirebaseAuthenticationWeb.ERROR_NO_USER_SIGNED_IN);
}
const idToken = await auth.currentUser.getIdToken();
const idToken = await auth.currentUser.getIdToken(options?.forceRefresh);
const result: GetIdTokenResult = {
token: idToken || '',
};
Expand Down

0 comments on commit 99d7fcc

Please sign in to comment.