diff --git a/packages/firebase-auth/README.md b/packages/firebase-auth/README.md index d138bd94..d6b72eb1 100644 --- a/packages/firebase-auth/README.md +++ b/packages/firebase-auth/README.md @@ -118,7 +118,18 @@ if (user && !user.emailVerified) { ### Signing Out ```ts -firebase().auth().signOut(); +firebase().auth().signOut() +.then(res => { + if(res) { + // user signed out + return + } + // else do staff +}); + +// OR + +let signedOut = await firebase().auth().signOut(); ``` ### Other sign-in methods diff --git a/packages/firebase-auth/index.android.ts b/packages/firebase-auth/index.android.ts index 1b4780eb..b8623305 100644 --- a/packages/firebase-auth/index.android.ts +++ b/packages/firebase-auth/index.android.ts @@ -1394,8 +1394,20 @@ export class Auth implements IAuth { }); } - signOut() { - return this.native?.signOut?.(); + async signOut(): Promise { + return new Promise((resolve, reject) => { + this.native?.signOut(); + let timeout = setTimeout(() => { + reject(false); + }, 3000); + this.addAuthStateChangeListener((user) => { + clearTimeout(timeout); + if(user) { + reject(false); + } + resolve(true); + }); + }) } get native() { diff --git a/packages/firebase-auth/index.d.ts b/packages/firebase-auth/index.d.ts index a04c2bd8..da4ea56d 100644 --- a/packages/firebase-auth/index.d.ts +++ b/packages/firebase-auth/index.d.ts @@ -357,7 +357,7 @@ export declare class Auth implements IAuth { signInWithEmailLink(email: string, emailLink: string): Promise; - signOut(): boolean; + signOut(): Promise; useUserAccessGroup(userAccessGroup: string): Promise; diff --git a/packages/firebase-auth/index.ios.ts b/packages/firebase-auth/index.ios.ts index 1b743ca4..03b34892 100644 --- a/packages/firebase-auth/index.ios.ts +++ b/packages/firebase-auth/index.ios.ts @@ -1237,8 +1237,8 @@ export class Auth implements IAuth { }); } - signOut() { - return this.native?.signOut?.(); + async signOut(): Promise { + return await this.native?.signOut?.(); } get native() {