The iOS implementation of google_sign_in
.
This package is endorsed, which means you can simply use google_sign_in
normally. This package will be automatically included in your app when you do, so you do not need to add it to your pubspec.yaml
.
However, if you import
this package to use any of its APIs directly, you should add it to your pubspec.yaml
as usual.
GoogleService-Info.plist
from step 2. Do not put this file in your project.GoogleService-Info.plist
into your app's [my_project]/ios/Runner/Info.plist
file.<key>GIDClientID</key> <!-- TODO Replace this value: --> <!-- Copied from GoogleService-Info.plist key CLIENT_ID --> <string>[YOUR IOS CLIENT ID]</string>
GIDServerClientID
key value pair in your [my_project]/ios/Runner/Info.plist
file.<key>GIDServerClientID</key> <string>[YOUR SERVER CLIENT ID]</string>
CFBundleURLTypes
attributes below into the [my_project]/ios/Runner/Info.plist
file.<!-- Put me in the [my_project]/ios/Runner/Info.plist file --> <!-- Google Sign-in Section --> <key>CFBundleURLTypes</key> <array> <dict> <key>CFBundleTypeRole</key> <string>Editor</string> <key>CFBundleURLSchemes</key> <array> <!-- TODO Replace this value: --> <!-- Copied from GoogleService-Info.plist key REVERSED_CLIENT_ID --> <string>com.googleusercontent.apps.861823949799-vc35cprkp249096uujjn0vvnmcvjppkn</string> </array> </dict> </array> <!-- End of the Google Sign-in Section -->
As an alternative to editing the Info.plist
in your Xcode project, you can instead configure your app in Dart code. In this case, skip steps 4 to 5 and pass clientId
and serverClientId
to the GoogleSignIn
constructor:
final GoogleSignIn googleSignIn = GoogleSignIn( // The OAuth client id of your app. This is required. clientId: 'Your Client ID', // If you need to authenticate to a backend server, specify its OAuth client. This is optional. serverClientId: 'Your Server ID', );
Note that step 6 is still required.