{"id":19444437,"url":"https://github.com/tnc1997/flutter-google-sign-in-desktop","last_synced_at":"2025-07-29T10:41:32.407Z","repository":{"id":258550644,"uuid":"807184479","full_name":"tnc1997/flutter-google-sign-in-desktop","owner":"tnc1997","description":"The desktop implementation of google_sign_in. Please note that this implementation is not endorsed.","archived":false,"fork":false,"pushed_at":"2024-10-18T19:08:14.000Z","size":219,"stargazers_count":3,"open_issues_count":4,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-19T14:25:23.041Z","etag":null,"topics":["dart","flutter","google-sign-in"],"latest_commit_sha":null,"homepage":"","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tnc1997.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"buy_me_a_coffee":"tnc1997","ko_fi":"tnc1997"}},"created_at":"2024-05-28T16:07:34.000Z","updated_at":"2024-10-17T10:43:56.000Z","dependencies_parsed_at":"2024-10-26T10:10:17.251Z","dependency_job_id":null,"html_url":"https://github.com/tnc1997/flutter-google-sign-in-desktop","commit_stats":null,"previous_names":["tnc1997/flutter-google-sign-in-desktop"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tnc1997%2Fflutter-google-sign-in-desktop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tnc1997%2Fflutter-google-sign-in-desktop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tnc1997%2Fflutter-google-sign-in-desktop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tnc1997%2Fflutter-google-sign-in-desktop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tnc1997","download_url":"https://codeload.github.com/tnc1997/flutter-google-sign-in-desktop/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223976321,"owners_count":17234751,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dart","flutter","google-sign-in"],"created_at":"2024-11-10T16:07:03.392Z","updated_at":"2024-11-10T16:07:03.969Z","avatar_url":"https://github.com/tnc1997.png","language":"Dart","funding_links":["https://buymeacoffee.com/tnc1997","https://ko-fi.com/tnc1997"],"categories":[],"sub_categories":[],"readme":"# google_sign_in_desktop\n\nThe desktop implementation of [`google_sign_in`](https://pub.dev/packages/google_sign_in). Please note that this implementation is not endorsed.\n\nThe desktop implementation uses the [Authorization Code Flow with Proof Key for Code Exchange (PKCE)](https://datatracker.ietf.org/doc/html/rfc7636) flow, with the [loopback address](https://developers.google.com/identity/protocols/oauth2/native-app#redirect-uri_loopback) as the `redirect_uri`, to get tokens.\n\n## Getting Started\n\n1. Add this package as a dependency because it is [not endorsed](https://flutter.dev/docs/development/packages-and-plugins/developing-packages#non-endorsed-federated-plugin).\n\n   ```yaml\n   dependencies:\n     google_sign_in: ^6.0.0\n     google_sign_in_desktop: { git: https://github.com/tnc1997/flutter-google-sign-in-desktop.git }\n     google_sign_in_platform_interface: ^2.0.0\n   ```\n2. Implement `GoogleSignInDesktopStore\u003cGoogleSignInDesktopTokenData\u003e` to store tokens between sessions.\n\n   ```dart\n   class GoogleSignInDesktopTokenDataStore implements GoogleSignInDesktopStore\u003cGoogleSignInDesktopTokenData\u003e {\n     const GoogleSignInDesktopTokenDataStore();\n   \n     @override\n     Future\u003cGoogleSignInDesktopTokenData?\u003e get() async {}\n\n     @override\n     Future\u003cvoid\u003e set(GoogleSignInDesktopTokenData? value) async {}\n   }\n   ```\n\n   \u003e Your application should store both tokens in a secure, long-lived location that is accessible between different invocations of your application. The refresh token enables your application to obtain a new access token if the one that you have expires. As such, if your application loses the refresh token, the user will need to repeat the OAuth 2.0 consent flow so that your application can obtain a new refresh token.\n\n3. Follow the instructions [here](https://developers.google.com/identity/protocols/oauth2/native-app) to create a desktop OAuth client.\n4. Update `main.dart` to initialize the plugin and set the required instance fields.\n\n   ```dart\n   const scopes = \u003cString\u003e[\n     'email',\n     'https://www.googleapis.com/auth/contacts.readonly',\n   ];\n\n   final _googleSignIn = GoogleSignIn(\n     clientId: 'YOUR_GOOGLE_SIGN_IN_OAUTH_CLIENT_ID.apps.googleusercontent.com',\n     scopes: scopes,\n   );\n\n   void main() {\n     if (GoogleSignInPlatform.instance case GoogleSignInDesktop instance) {\n       instance.clientSecret = 'YOUR_GOOGLE_SIGN_IN_OAUTH_CLIENT_SECRET';\n       instance.tokenDataStore = const GoogleSignInDesktopTokenDataStore();\n     }\n   \n     runApp(const MyApp());\n   }\n   ```\n\n   \u003e Installed apps are distributed to individual devices, and it is assumed that these apps cannot keep secrets. They can access Google APIs while the user is present at the app or when the app is running in the background. Incremental authorization with installed apps is not supported due to the fact that the client cannot keep the client_secret confidential.\n\n5. Read the documentation [here](https://pub.dev/packages/google_sign_in) for more information on how to use `google_sign_in`.\n\n## Compatibility\n\nThe desktop implementation implements the following methods:\n\n| Method            |    |\n|-------------------|----|\n| `canAccessScopes` | ❌  |\n| `clearAuthCache`  | ✔️ |\n| `disconnect`      | ✔️ |\n| `getTokens`       | ✔️ |\n| `init`            | ✔️ |\n| `isSignedIn`      | ✔️ |\n| `requestScopes`   | ✔️ |\n| `signIn`          | ✔️ |\n| `signInSilently`  | ✔️ |\n| `signOut`         | ✔️ |\n\n## Dependencies\n\nThe desktop implementation depends on the following packages:\n\n| Package        |                                                                                                                     |\n|----------------|---------------------------------------------------------------------------------------------------------------------|\n| `crypto`       | This package is required to create the code challenge, which is the SHA256 hash of the ASCII encoded code verifier. |\n| `http`         | This package is required to send the token request, the userinfo request, and the revocation request.               |\n| `url_launcher` | This package is required to launch the authorization url, which opens the browser and prompts the user to sign in.  |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftnc1997%2Fflutter-google-sign-in-desktop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftnc1997%2Fflutter-google-sign-in-desktop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftnc1997%2Fflutter-google-sign-in-desktop/lists"}