# google_sign_in_web 1.1.3

Flutter plugin for Google Sign-In, a secure authentication system for signing in with a Google account on Android, iOS and Web.




## Installing
```
export PUB_HOSTED_URL=https://pub.mirror.p-hatan.com
flutter pub add 'google_sign_in_web:1.1.3'
```
Published: 2026-03-13T17:37:15.539246Z
Expected archive SHA-256: d473003eeca892f96a01a64fc803378be765071cb0c265ee872c7f8683245d14

Available in cache; verification: upstream_checksum
## Direct dependencies
- flutter: map[sdk:flutter]
- flutter_web_plugins: map[sdk:flutter]
- google_identity_services_web: ^0.3.1
- google_sign_in_platform_interface: ^3.1.0
- http: >=0.13.0 <2.0.0
- web: >=0.5.1 <2.0.0

## Package README (untrusted upstream documentation)
# google\_sign\_in\_web

The web implementation of [google_sign_in](https://pub.dev/packages/google_sign_in)

## Usage

This package is [endorsed](https://flutter.dev/to/endorsed-federated-plugin),
which means you can simply use `google_sign_in`
normally. This package will be automatically included in your app when you do,
so you do not need to add it to your `pubspec.yaml`.

However, if you `import` this package to use any of its APIs directly, you
should add it to your `pubspec.yaml` as usual.

For example, you need to import this package directly if you plan to use the
web-only `Widget renderButton()` method.

## Integration

First, go through the instructions [here](https://developers.google.com/identity/gsi/web/guides/get-google-api-clientid) to create your Google Sign-In OAuth client ID.

On your `web/index.html` file, add the following `meta` tag, somewhere in the
`head` of the document:

```html
<meta name="google-signin-client_id" content="YOUR_GOOGLE_SIGN_IN_OAUTH_CLIENT_ID.apps.googleusercontent.com">
```

For this client to work correctly, the last step is to configure the **Authorized JavaScript origins**, which _identify the domains from which your application can send API requests._ When in local development, this is normally `localhost` and some port.

You can do this by:

1. Going to the [Credentials page](https://console.developers.google.com/apis/credentials).
2. Clicking "Edit" in the OAuth 2.0 Web application client that you created above.
3. Adding the URIs you want to the **Authorized JavaScript origins**.

For local development, you must add two `localhost` entries:

* `http://localhost` and
* `http://localhost:7357` (or any port that is free in your machine)

### Starting flutter in http://localhost:7357

Normally `flutter run` starts in a random port. In the case where you need to deal with authentication like the above, that's not the most appropriate behavior.

You can tell `flutter run` to listen for requests in a specific host and port with the following:

```sh
flutter run -d chrome --web-hostname localhost --web-port 7357
```

## Authentication

This implementation returns false for `supportsAuthentication`, and will throw
if `authenticate` is called. This is because the
[Google Identity Services (GIS) SDK](https://developers.google.com/identity/gsi/web/guides/overview)
only allows signing in using UI provided by the SDK.

On the web, instead of providing custom UI that calls `authenticate`, you should
display the Widget returned by `renderButton` (from `web_only.dart`), and listen
to `authenticationEvents` to know when the user has signed in.

The GIS SDK does not renew authentication sessions. Once the token expires
(after 3600 seconds), if you need to use the `idToken` again you must trigger
a new authentication flow. In most cases, you should use the `idToken`
immediately after authentication, and track sign-in state at the application
level, or via a separate server backend.

### Migration from versions before 0.12

See [Migrating from Google Sign-In](https://developers.google.com/identity/gsi/web/guides/migration)
for information about the differences between authentication in the GIS SDK and
the SDK used in older versions of this plugin.

Since the GIS SDK does _not_ manage user sessions anymore, apps that relied on
this feature might break. If long-lived sessions are required, consider using
some user authentication system that supports Google Sign In as a federated
Authentication provider, like
[Firebase Auth](https://firebase.google.com/docs/auth/flutter/federated-auth#google).

## Authorization

The GIS SDK does not renew authorization sessions. Once the token expires
(after 3600 seconds), API requests will begin to fail, and you must re-request
user authorization. For example:

* `401`: Missing or invalid access token.
* `403`: Expired access token.

See the "Integration considerations > [UX separation for authentication and authorization](https://developers.google.com/identity/gsi/web/guides/integrate#ux_separation_for_authentication_and_authorization)
guide" in the official GIS SDK documentation for more information about this.

### Migration from versions before 0.12

See [Migrate to Google Identity Services](https://developers.google.com/identity/oauth2/web/guides/migration-to-gis)
for information about the differences between authentication in the GIS SDK and
the SDK used in older versions of this plugin.

## Changelog
## 1.1.3

* Restored previously reverted changes to prevent `_initCalled` from being invoked twice on web.
* Fixed `renderButton` being stuck on "Getting ready" on web by correcting the `FutureBuilder` state check to use `ConnectionState.done`.

## 1.1.2

* Reverts "Throws a more actionable error when init is called more than once."

## 1.1.1 (withdrawn)

* Throws a more actionable error when init is called more than once.
* Updates minimum supported SDK version to Flutter 3.35/Dart 3.9.

## 1.1.0

* Adds support for the `clearAuthorizationToken` method.
* Updates minimum supported SDK version to Flutter 3.29/Dart 3.7.

## 1.0.0

* **BREAKING CHANGE**: Switches to implementing version 3.0 of the platform
  interface package, rather than 2.x, significantly changing the API surface.
* Updates minimum supported SDK version to Flutter 3.27/Dart 3.6.

## 0.12.4+4

* Asserts that new `forceAccountName` parameter is null (not used in web).
* Updates minimum supported SDK version to Flutter 3.22/Dart 3.4.

## 0.12.4+3

* Fixes callback types for `TokenClientConfig`.

## 0.12.4+2

* Adds support for `web: ^1.0.0`.

## 0.12.4+1

* Fixes README.md typo.

## 0.12.4

* Updates dependencies to `web: ^0.5.0` and `google_identity_services_web: ^0.3.1`.

## 0.12.3+3

* Updates SDK version to Dart `^3.3.0`. Flutter `^3.19.0`.
* Prepares update to package `web: ^0.5.0`.

## 0.12.3+2

* Fixes new lint warnings.

## 0.12.3+1

* Updates `FlexHtmlElementView` (the widget backing `renderButton`) to not
  rely on web engine knowledge (a platform view CSS selector) to operate.

## 0.12.3

* Migrates to `package:web`.
* Updates minimum supported SDK version to Flutter 3.16.0/Dart 3.2.0.

## 0.12.2+1

* Re-publishes `0.12.2` with a small fix to the CodeClient initialization.

## 0.12.2 (withdrawn)

* Adds server auth code retrieval to google_sign_in_web.
* Adds `web_only` library to access web-only methods more easily.

## 0.12.1

* Enables FedCM on browsers that support this authentication mechanism.
* Uses the expiration timestamps of Credential and Token responses to improve
  the accuracy of `isSignedIn` and `canAccessScopes` methods.
* Deprecates `signIn()` method.
  * Users should migrate to `renderButton` and `silentSignIn`, as described in
    the README.

## 0.12.0+5

* Migrates to `dart:ui_web` APIs.
* Updates minimum supported SDK version to Flutter 3.13.0/Dart 3.1.0.

## 0.12.0+4

* Adds pub topics to package metadata.
* Updates minimum supported SDK version to Flutter 3.7/Dart 2.19.

## 0.12.0+3

* Fixes null cast error on accounts without picture or name details.

## 0.12.0+2

* Adds compatibility with `http` 1.0.

## 0.12.0+1

* Fixes unawaited_futures violations.

## 0.12.0

* Authentication:
  * Adds web-only `renderButton` method and its configuration object, as a new
    authentication mechanism.
  * Prepares a `userDataEvents` Stream, so the Google Sign In Button can propagate
    authentication changes to the core plugin.
  * **Breaking Change:** `signInSilently` now returns an authenticated (but not authorized) user.
* Authorization:
  * Implements the new `canAccessScopes` method.
  * Ensures that the `requestScopes` call doesn't trigger user selection when the
    current user is known (similar to what `signIn` does).
* Updates minimum Flutter version to 3.3.

## 0.11.0+2

* Clarifies explanation of endorsement in README.
* Aligns Dart and Flutter SDK constraints.

## 0.11.0+1

* Updates links for the merge of flutter/plugins into flutter/packages.

## 0.11.0

* **Breaking Change:** Migrates JS-interop to `package:google_identity_services_web`
  * Uses the new Google Identity Authentication and Authorization JS SDKs. [Docs](https://developers.google.com/identity).
    * Added "Migrating to v0.11" section to the `README.md`.
* Updates minimum Flutter version to 3.0.

## 0.10.2+1

* Updates code for `no_leading_underscores_for_local_identifiers` lint.
* Updates minimum Flutter version to 2.10.
* Renames generated folder to js_interop.

## 0.10.2

* Migrates to new platform-interface `initWithParams` method.
* Throws when unsupported `serverClientId` option is provided.

## 0.10.1+3

* Updates references to the obsolete master branch.

## 0.10.1+2

* Minor fixes for new analysis options.

## 0.10.1+1

* Fixes library_private_types_in_public_api, sort_child_properties_last and use_key_in_widget_constructors
  lint warnings.

## 0.10.1

* Updates minimum Flutter version to 2.8.
* Passes `plugin_name` to Google Sign-In's `init` method so new applications can
  continue using this plugin after April 30th 2022. Issue [#88084](https://github.com/flutter/flutter/issues/88084).

## 0.10.0+5

* Internal code cleanup for stricter analysis options.

## 0.10.0+4

* Removes dependency on `meta`.

## 0.10.0+3

* Updated URL to the `google_sign_in` package in README.

## 0.10.0+2

* Add `implements` to pubspec.

## 0.10.0+1

* Updated installation instructions in README.

## 0.10.0

* Migrate to null-safety.

## 0.9.2+1

* Update Flutter SDK constraint.

## 0.9.2

* Throw PlatformExceptions from where the GMaps SDK may throw exceptions: `init()` and `signIn()`.
* Add two new JS-interop types to be able to unwrap JS errors in release mode.
* Align the fields of the thrown PlatformExceptions with the mobile version.
* Migrate tests to run with `flutter drive`

## 0.9.1+2

* Update package:e2e reference to use the local version in the flutter/plugins
  repository.

## 0.9.1+1

* Remove Android folder from `google_sign_in_web`.

## 0.9.1

* Ensure the web code returns `null` when the user is not signed in, instead of a `null-object` User. Fixes [issue 52338](https://github.com/flutter/flutter/issues/52338).

## 0.9.0

* Add support for methods introduced in `google_sign_in_platform_interface` 1.1.0.

## 0.8.4

* Remove all `fakeConstructor$` from the generated facade. JS interop classes do not support non-external constructors.

## 0.8.3+2

* Make the pedantic dev_dependency explicit.

## 0.8.3+1

* Updated documentation with more instructions about Google Sign In web setup.

## 0.8.3

* Fix initialization error that causes https://github.com/flutter/flutter/issues/48527
* Throw a PlatformException when there's an initialization problem (like wrong server-side config).
* Throw a StateError when checking .initialized before calling .init()
* Update setup instructions in the README.

## 0.8.2+1

* Add a non-op Android implementation to avoid a flaky Gradle issue.

## 0.8.2

* Require Flutter SDK 1.12.13+hotfix.4 or greater.

## 0.8.1+2

* Remove the deprecated `author:` field from pubspec.yaml
* Require Flutter SDK 1.10.0 or greater.

## 0.8.1+1

* Add missing documentation.

## 0.8.1

* Add podspec to enable compilation on iOS.

## 0.8.0

* Flutter for web initial release







 
