Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion packages/firebase-auth/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 14 additions & 2 deletions packages/firebase-auth/index.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1394,8 +1394,20 @@ export class Auth implements IAuth {
});
}

signOut() {
return this.native?.signOut?.();
async signOut(): Promise<boolean> {
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() {
Expand Down
2 changes: 1 addition & 1 deletion packages/firebase-auth/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ export declare class Auth implements IAuth {

signInWithEmailLink(email: string, emailLink: string): Promise<UserCredential>;

signOut(): boolean;
signOut(): Promise<boolean>;

useUserAccessGroup(userAccessGroup: string): Promise<void>;

Expand Down
4 changes: 2 additions & 2 deletions packages/firebase-auth/index.ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1237,8 +1237,8 @@ export class Auth implements IAuth {
});
}

signOut() {
return this.native?.signOut?.();
async signOut(): Promise<boolean> {
return await this.native?.signOut?.();
}

get native() {
Expand Down