Skip to content

Commit fdee173

Browse files
authored
Update README.md (#368)
Use with updated firebase@^10.11
1 parent b91b485 commit fdee173

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,20 @@ initializeApp() {
9999
sign in function
100100

101101
```ts
102+
import { GoogleAuth } from "@codetrix-studio/capacitor-google-auth";
103+
import { Auth, GoogleAuthProvider, signInWithCredential } from '@angular/fire/auth';
104+
102105
async googleSignIn() {
103106
let googleUser = await GoogleAuth.signIn();
104107

105108
/*
106109
If you use Firebase you can forward and use the logged in Google user like this:
107110
*/
108-
const credential = auth.GoogleAuthProvider.credential(googleUser.authentication.idToken);
109-
return this.afAuth.auth.signInAndRetrieveDataWithCredential(credential);
111+
constructor(private auth: Auth){}
112+
113+
const googleUser = await GoogleAuth.signIn();
114+
const _credential = GoogleAuthProvider.credential(googleUser.authentication.idToken);
115+
return signInWithCredential(this.auth, _credential);
110116
}
111117
```
112118

0 commit comments

Comments
 (0)