GoogleAPI with Google Sign In Account GoogleAPI with Google Sign In Account dart dart

GoogleAPI with Google Sign In Account


I am not an expert on flutter but based on the examples found here The only things you need to autenticate to firebase programatically are the token_id and the access_token just like this:

final AuthCredential credential = GoogleAuthProvider.getCredential(    accessToken: googleAuth.accessToken,    idToken: googleAuth.idToken,  );

Acording to that, to authenticate to firebase you just need to add the Sign in scopes: 'email', 'profile' and 'openid' or the scopes: 'https://www.googleapis.com/auth/userinfo.email', 'https://www.googleapis.com/auth/userinfo.profile' and 'openid' (They usually represent the same depending on the library used). Then with the resulted access token you can use the firebase library to autenticate to firebase without re-authenticating.Let me know if you need more information.

Edit:

You have to find the acces token received by Google sign in and pass the information fo firebase sign in. The access token should look something like this:

{        "access_token": "ya29.a0Adw1xekVMTQRK0_EAdr1PfiOS97Lnz-VCLTJHw7...",        "expires_in": 3599,         "refresh_token": "1//01iBd1CQsBUl2CgYIARAA...",         "scope": "https://www.googleapis.com/auth/userinfo.email openid",         "token_type": "Bearer",         "id_token": "eyJhbGciOiJSUzI1NiIsImtpZCI6IjE31ZmY0ZTEwOTkxZDZiMGA..."}