baumblatt / capacitor-firebase-auth

Capacitor Firebase Authentication Plugin
MIT License
261 stars 129 forks source link

Get access token Google #218

Open tbcy opened 2 years ago

tbcy commented 2 years ago

Hello,

I'm trying to retrieve the access token when I connect to Google, but I can't. There is an access token available, but it is not the one that allows to retrieve the user from the back office. Indeed, I use Socialite (Laravel) to retrieve the user from the back office and I create an account if it does not exist.

Here is the code i use in front.

cfaSignInGoogle().subscribe( async result => { console.log(result); const copy = JSON.stringify(result.result.idToken); const body = { accessToken: copy } let res = await this.authService._firebase_authorize(body); let json = await res.json(); if (res.ok) { this.jwtService.set_token_storage(json.data.access_token); this.storageService.set('user', JSON.stringify(json.data.user)); this.go_to_welcome_page(); } else { // this.present_alert(); this.store.dispatch(hide()); } }, (error) => { alert('Une erreur est survenue lors de la connexion avec Google. Veuillez réessayer plus tard.'); });

I can see the good access token in the calls made to google api. And the good access token is this one :

Capture_d’écran_2022-05-31_à_10_15_35

Is there a way to get this token ?

Thanks.