diff --git a/.changeset/hip-flies-arrive.md b/.changeset/hip-flies-arrive.md new file mode 100644 index 00000000..b0ecef37 --- /dev/null +++ b/.changeset/hip-flies-arrive.md @@ -0,0 +1,5 @@ +--- +"@capacitor-firebase/authentication": minor +--- + +Pass through force refresh to firebase diff --git a/packages/authentication/src/web.ts b/packages/authentication/src/web.ts index d6c0418f..1e0a53f9 100644 --- a/packages/authentication/src/web.ts +++ b/packages/authentication/src/web.ts @@ -31,6 +31,7 @@ import type { CreateUserWithEmailAndPasswordOptions, FirebaseAuthenticationPlugin, GetCurrentUserResult, + GetIdTokenOptions, GetIdTokenResult, SendPasswordResetEmailOptions, SetLanguageCodeOptions, @@ -88,12 +89,12 @@ export class FirebaseAuthenticationWeb return result; } - public async getIdToken(): Promise { + public async getIdToken(options?: GetIdTokenOptions): Promise { 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 || '', };