Reputation: 57
I am trying to retrieve the google server auth code via google_sign_in package and worked my way through multiple git hub issues and finally found this pull request, which is supposed to fix the issues with this endeavour.
In this pull request, for iOS, it is suggested to add the following lines to GoogleService-Info.plist
:
<key>SERVER_CLIENT_ID</key>
<string>YOUR_SERVER_CLIENT_ID</string>
I tried to use the client id for my iOS Flutter App I created via Google Cloud Platform / API & Services / Credentials for my Firebase project, but getServerAuthCode
still returns null.
Where can I find the correct server client id?
/edit: i also tried creating a Client ID for Web application from the google console as described here What are APP_CLIENT_ID and SERVER_CLIENT_ID and where do I find them? but getServerAuthCode
still returns null.
Upvotes: 2
Views: 1264
Reputation: 57
The google_sign_in package implementation is wrong. I used the fix provided here and was able to retrieve the server auth token.
You can just add google_sign_in your project like (in your pubspec.yaml file)
google_sign_in:
git:
url: https://github.com/aseef17/plugins.git
path: packages/google_sign_in/google_sign_in
ref: master
And add a dependacy override for google_sign_in_platform_interface
dependency_overrides:
google_sign_in_platform_interface:
git:
url: https://github.com/aseef17/plugins.git
path: packages/google_sign_in/google_sign_in_platform_interface
To get this to work in for iOS, you have to add a new key in your GoogleService-Info.plist file
<key>SERVER_CLIENT_ID</key> <string>YOUR_CLIENT_ID_HERE</string>
Where the server client id can be created in your Firebase project via Google Cloud Platform / API & Services / Credentials. (use web application for iOS! as described here)
Upvotes: 2