-
Notifications
You must be signed in to change notification settings - Fork 78
fix: Update Google Sign In setup to use new Google Auth Platform #393
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -122,3 +122,30 @@ If lightweight sign-in fails (e.g., no previous session exists or the user dismi | |
| :::note | ||
| The lightweight sign-in attempt happens automatically when the controller is initialized, typically at app launch. If successful, users will be signed in without any additional interaction. | ||
| ::: | ||
|
|
||
| ### Configuring Client IDs via Environment Variables | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: Since on the Initializing the `GoogleSignInService session we do not show the other possibility of also passing the values directly on code, we could turn this session into a "Configuring Client IDs on the app" and have both options detailed (code and env vars). See the other one below: |
||
|
|
||
| Instead of hardcoding client IDs in platform-specific configuration files, you can pass them during build time using the `--dart-define` option. The Google Sign-In provider exposes the following environment variables: | ||
|
|
||
| - `GOOGLE_CLIENT_ID`: The platform-specific OAuth client ID | ||
| - `GOOGLE_SERVER_CLIENT_ID`: The server (web application) OAuth client ID | ||
|
|
||
| If `clientId` and `serverClientId` values are not supplied when initializing the service, the provider will automatically fetch them from these environment variables. | ||
|
|
||
| **Example usage:** | ||
|
|
||
| ```bash | ||
| flutter run \ | ||
| -d "<device>" \ | ||
| --dart-define="GOOGLE_CLIENT_ID=<platform_client_id>.apps.googleusercontent.com" \ | ||
| --dart-define="GOOGLE_SERVER_CLIENT_ID=<web_client_id>.apps.googleusercontent.com" | ||
| ``` | ||
|
|
||
| This approach is useful when you need to: | ||
| - Manage separate client IDs for different platforms (Android, iOS, Web) in a centralized way | ||
| - Avoid committing client IDs to version control | ||
| - Configure different credentials for different build environments (development, staging, production) | ||
|
|
||
| :::tip | ||
| You can also set these environment variables in your IDE's run configuration or CI/CD pipeline to avoid passing them manually each time. | ||
| ::: | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice to have the dark mode! Is it possible to increase the resolution of the new screenshots (in general, not only this one)? The previous were a little bit sharper (you can see they were using considerably higher resolution). |
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one is not much visible due to the resolution, and can also be a lot smaller to better fit the content. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: It is worth adding a tip here about the possibility of adding extra scopes to use with the
getExtraGoogleInfoCallbackcallback on the server. Then, cross-reference this section on an info on this one from the link to show how to configure extra scopes that theaccessTokenwill have access to.