google_sign_in 0.0.1 copy "google_sign_in: ^0.0.1" to clipboard
google_sign_in: ^0.0.1 copied to clipboard

outdatedDart 1 only

Google Sign-In plugin for Flutter.

google_sign_in #

A Flutter plugin for Google Sign In.

Note: This is a work-in-progress, and is not fully supported by the Flutter team. (For example, we don't have this under continuous integration and testing.)

Android integration #

To access Google Sign-In, you'll need to make sure to register your application.

You don't need to include the google-services.json file in your app unless you are using Google services that require it. You do need to enable the OAuth APIs that you want, using the Google Cloud Platform API manager. For example, if you want to mimic the behavior of the Google Sign-In sample app, you'll need to enable the Google People API.

iOS integration #

To access Google Sign-In, you'll need to make sure to register your application. Add the generated GoogleService-Info.plist to root of your Runner project in Xcode, so that the Google Sign-In framework can determine your client id.

You'll need to add this to the main dictionary of your application's Info.plist:

        <key>CFBundleURLTypes</key>
        <array>
                <dict>
                        <key>CFBundleTypeRole</key>
                        <string>Editor</string>
                        <key>CFBundleURLSchemes</key>
                        <array>
                                <!-- bundle id, for example: -->
                                <string>com.yourcompany.myapp</string>
                        </array>
                </dict>
                <dict>
                        <key>CFBundleTypeRole</key>
                        <string>Editor</string>
                        <key>CFBundleURLSchemes</key>
                        <array>
                                <!-- reverse url of your client id, for example: -->
        <string>com.googleusercontent.apps.861823949799-11qfr04mrfh2mndp3el2vgc0e357a2t6</string>
                        </array>
                </dict>
        </array>

Usage #

Add the following import to your Dart code:

import 'package:google_sign_in/google_sign_in.dart';

Initialize GoogleSignIn with the scopes you want:

GoogleSignIn.initialize(
    scopes: [
      'email',
      'https://www.googleapis.com/auth/contacts.readonly',
    ],
);

You can now use the GoogleSignIn class to authenticate in your Dart code, e.g.

GoogleSignInAccount account = await (await GoogleSignIn.instance).signIn();

See google_sign_in.dart for more API details.

Issues and feedback #

Please file issues to send feedback or report a bug. Thank you!