-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
In addition to basic sign in, I've been using the Google Sign In package for gaining access to additional scopes on the user such as 'https://www.googleapis.com/auth/userinfo.email' and 'https://www.googleapis.com/auth/adwords'. I am successfully able to obtain the ServerAuthCode on Android, however when the same piece of code outlined below is executed on iOS, I am receiving a null value.
I am currently still using the "Info.plist and GoogleServices.plist" method to pass in the various Google credentials into app. The client ID used is one that was "auto created by the Google Service".
Expected results:
Upon selecting an account to authenticate and consenting to some scopes, a ServerAuthCode is generated, which is sent to a backend API endpoint for further operations.
Actual results:
After selecting an account and consenting to the scopes, the ServerAuthCode returns as null, which subsequently makes operations in the backend API endpoint fail.
await googleSignIn.signOut();
final googleSignInAccount = await googleSignIn.signIn();
print(googleSignInAccount.serverAuthCode);
final linking = await http.post(
Uri.parse(''),
headers: {
'Authorization': currentJwtToken
},
body: {
"servertoken": googleSignInAccount.serverAuthCode,
"email": currentUserEmail,
"accessToken": "",
"code": "",
"redirect_uri": ""
});
print(linking.body);
return jsonDecode(linking.body);
await googleSignIn.signOut();
final googleSignInAccount = await googleSignIn.signIn();
print(googleSignInAccount.serverAuthCode);
final linking = await http.post(
Uri.parse(''),
headers: {
'Authorization': currentJwtToken
},
body: {
"servertoken": googleSignInAccount.serverAuthCode,
"email": currentUserEmail,
"accessToken": "",
"code": "",
"redirect_uri": ""
});
print(linking.body);
return jsonDecode(linking.body);