Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/google_sign_in/google_sign_in/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## NEXT

* Fixed links in `README.md`.

## 5.0.2

* Fix flutter/flutter#48602 iOS flow shows account selection, if user is signed in to Google on the device.
Expand Down
69 changes: 38 additions & 31 deletions packages/google_sign_in/google_sign_in/README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,42 @@
# google_sign_in

[![pub package](https://img.shields.io/pub/v/google_sign_in.svg)](https://pub.dev/packages/google_sign_in)

A Flutter plugin for [Google Sign In](https://developers.google.com/identity/).

*Note*: This plugin is still under development, and some APIs might not be available yet. [Feedback](https://github.com/flutter/flutter/issues) and [Pull Requests](https://github.com/flutter/plugins/pulls) are most welcome!
_Note_: This plugin is still under development, and some APIs might not be
available yet. [Feedback](https://github.com/flutter/flutter/issues) and
[Pull Requests](https://github.com/flutter/plugins/pulls) are most welcome!

## Android integration

To access Google Sign-In, you'll need to make sure to [register your
application](https://developers.google.com/mobile/add?platform=android).
To access Google Sign-In, you'll need to make sure to
[register your application](https://firebase.google.com/docs/android/setup).

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](https://console.developers.google.com/). 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](https://developers.google.com/people/).
that you want, using the
[Google Cloud Platform API manager](https://console.developers.google.com/). 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](https://developers.google.com/people/).

Make sure you've filled out all required fields in the console for [OAuth consent screen](https://console.developers.google.com/apis/credentials/consent). Otherwise, you may encounter `APIException` errors.
Make sure you've filled out all required fields in the console for
[OAuth consent screen](https://console.developers.google.com/apis/credentials/consent).
Otherwise, you may encounter `APIException` errors.

## iOS integration

1. [First register your application](https://developers.google.com/mobile/add?platform=ios).
2. Make sure the file you download in step 1 is named `GoogleService-Info.plist`.
3. Move or copy `GoogleService-Info.plist` into the `[my_project]/ios/Runner` directory.
4. Open Xcode, then right-click on `Runner` directory and select `Add Files to "Runner"`.
1. [First register your application](https://firebase.google.com/docs/ios/setup).
2. Make sure the file you download in step 1 is named
`GoogleService-Info.plist`.
3. Move or copy `GoogleService-Info.plist` into the `[my_project]/ios/Runner`
directory.
4. Open Xcode, then right-click on `Runner` directory and select
`Add Files to "Runner"`.
5. Select `GoogleService-Info.plist` from the file manager.
6. A dialog will show up and ask you to select the targets, select the `Runner` target.
7. Then add the `CFBundleURLTypes` attributes below into the `[my_project]/ios/Runner/Info.plist` file.
6. A dialog will show up and ask you to select the targets, select the `Runner`
target.
7. Then add the `CFBundleURLTypes` attributes below into the
`[my_project]/ios/Runner/Info.plist` file.

```xml
<!-- Put me in the [my_project]/ios/Runner/Info.plist file -->
Expand All @@ -51,21 +59,26 @@ Make sure you've filled out all required fields in the console for [OAuth consen

### iOS additional requirement

Note that according to https://developer.apple.com/sign-in-with-apple/get-started,
starting June 30, 2020, apps that use login services must also offer a "Sign in
with Apple" option when submitting to the Apple App Store.
Note that according to
https://developer.apple.com/sign-in-with-apple/get-started, starting June 30,
2020, apps that use login services must also offer a "Sign in with Apple" option
when submitting to the Apple App Store.

Consider also using an Apple sign in plugin from pub.dev.

The Flutter Favorite [sign_in_with_apple](https://pub.dev/packages/sign_in_with_apple)
plugin could be an option.
The Flutter Favorite
[sign_in_with_apple](https://pub.dev/packages/sign_in_with_apple) plugin could
be an option.

## Usage

### Import the package
To use this plugin, follow the [plugin installation instructions](https://pub.dev/packages/google_sign_in#pub-pkg-tab-installing).

To use this plugin, follow the
[plugin installation instructions](https://pub.dev/packages/google_sign_in#pub-pkg-tab-installing).

### Use the plugin

Add the following import to your Dart code:

```dart
Expand All @@ -82,6 +95,7 @@ GoogleSignIn _googleSignIn = GoogleSignIn(
],
);
```

[Full list of available scopes](https://developers.google.com/identity/protocols/googlescopes).

You can now use the `GoogleSignIn` class to authenticate in your Dart code, e.g.
Expand All @@ -98,13 +112,6 @@ Future<void> _handleSignIn() async {

## Example

Find the example wiring in the [Google sign-in example application](https://github.com/flutter/plugins/blob/master/packages/google_sign_in/google_sign_in/example/lib/main.dart).

## API details

See the [google_sign_in.dart](https://github.com/flutter/plugins/blob/master/packages/google_sign_in/google_sign_in/lib/google_sign_in.dart) for more API details.

## Issues and feedback
Find the example wiring in the
[Google sign-in example application](https://github.com/flutter/plugins/blob/master/packages/google_sign_in/google_sign_in/example/lib/main.dart).

Please file [issues](https://github.com/flutter/flutter/issues/new)
to send feedback or report a bug. Thank you!