Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
update README again
  • Loading branch information
vashworth committed Nov 3, 2023
commit 57a2b31b9ff7540d5a7fe7165a17bf176f009a03
24 changes: 15 additions & 9 deletions packages/google_sign_in/google_sign_in_ios/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,28 @@ should add it to your `pubspec.yaml` as usual.

### iOS integration

1. [Get an OAuth client ID](https://developers.google.com/identity/sign-in/ios/start-integrating#get_an_oauth_client_id).
2. Add your client ID into your app's `[my_project]/ios/Runner/Info.plist` file.
1. [Create a Firebase project](https://firebase.google.com/docs/ios/setup#create-firebase-project)
and [register your application](https://firebase.google.com/docs/ios/setup#register-app).
2. [Enable Google Sign-In for your Firebase project](https://firebase.google.com/docs/auth/ios/google-signin#enable_google_sign-in_for_your_firebase_project).
3. Make sure to download a new copy of your project's
`GoogleService-Info.plist` from step 2. Do not put this file in your project.
4. Add the client ID from the `GoogleService-Info.plist` into your app's
`[my_project]/ios/Runner/Info.plist` file.
```xml
<key>GIDClientID</key>
<!-- TODO Replace this value: -->
<!-- Copied from GoogleService-Info.plist key CLIENT_ID -->
<string>[YOUR IOS CLIENT ID]</string>
```
3. If you need to authenticate to a backend server you can add a
5. If you need to authenticate to a backend server you can add a
`GIDServerClientID` key value pair in your `[my_project]/ios/Runner/Info.plist` file.
```xml
<key>GIDServerClientID</key>
<string>[YOUR SERVER CLIENT ID]</string>
```
4. Then add your reversed client ID in the `CFBundleURLTypes` attributes into the
6. Then add the `CFBundleURLTypes` attributes below into the
`[my_project]/ios/Runner/Info.plist` file.

The reversed client ID is shown under "iOS URL scheme" when [selecting an existing iOS OAuth client in the Cloud console](https://console.cloud.google.com/apis/credentials?project=_).

```xml
<!-- Put me in the [my_project]/ios/Runner/Info.plist file -->
<!-- Google Sign-in Section -->
Expand All @@ -44,15 +49,16 @@ should add it to your `pubspec.yaml` as usual.
<key>CFBundleURLSchemes</key>
<array>
<!-- TODO Replace this value: -->
<string>[YOUR REVERSED CLIENT ID]</string>
<!-- 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 2 to 3
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:

```dart
Expand All @@ -65,4 +71,4 @@ GoogleSignIn _googleSignIn = GoogleSignIn(
);
```

Note that step 4 is still required.
Note that step 6 is still required.