ae203771创建于 2025年11月13日历史提交
文件最后提交记录最后更新时间
Update repo for 3.38 (#10405) Does all of the steps from https://github.com/flutter/flutter/blob/master/docs/ecosystem/release/Updating-Packages-repo-for-a-stable-release.md for the 3.38 release (except the first one, which the stable roller will handle). This includes a lot of autoformat changes, because the N-2 is now 3.32, which means many packages are now being updated to a min Dart SDK of 3.8, triggering a formatter behavior change.6 个月前
Update repo for 3.38 (#10405) Does all of the steps from https://github.com/flutter/flutter/blob/master/docs/ecosystem/release/Updating-Packages-repo-for-a-stable-release.md for the 3.38 release (except the first one, which the stable roller will handle). This includes a lot of autoformat changes, because the N-2 is now 3.32, which means many packages are now being updated to a min Dart SDK of 3.8, triggering a formatter behavior change.6 个月前
Update repo for 3.38 (#10405) Does all of the steps from https://github.com/flutter/flutter/blob/master/docs/ecosystem/release/Updating-Packages-repo-for-a-stable-release.md for the 3.38 release (except the first one, which the stable roller will handle). This includes a lot of autoformat changes, because the N-2 is now 3.32, which means many packages are now being updated to a min Dart SDK of 3.8, triggering a formatter behavior change.6 个月前
[gis_web] Introduce new GIS SDK JS-Interop package. (#2653) 3 年前
Update repo for 3.38 (#10405) Does all of the steps from https://github.com/flutter/flutter/blob/master/docs/ecosystem/release/Updating-Packages-repo-for-a-stable-release.md for the 3.38 release (except the first one, which the stable roller will handle). This includes a lot of autoformat changes, because the N-2 is now 3.32, which means many packages are now being updated to a min Dart SDK of 3.8, triggering a formatter behavior change.6 个月前
Remove "All right reserved" from all files (#10066) Per guidance from legal on current preferred practice, remove "All rights reserved" from all LICENSE files and header blocks, and update the repo tool check accordingly.7 个月前
Update repo for 3.35 stable release (#9816) Does the steps listed at https://github.com/flutter/flutter/blob/master/docs/ecosystem/release/Updating-Packages-repo-for-a-stable-release.md for the 3.35 release. This makes the minimum supported version for all packages Dart 3.7, which means it picks up the new formatter. As a result, there are massive amounts of code changes; all of it is just the result of running dart format after changing the min SDK version.9 个月前
[gis_web] Introduce new GIS SDK JS-Interop package. (#2653) 3 年前
Update repo for 3.38 (#10405) Does all of the steps from https://github.com/flutter/flutter/blob/master/docs/ecosystem/release/Updating-Packages-repo-for-a-stable-release.md for the 3.38 release (except the first one, which the stable roller will handle). This includes a lot of autoformat changes, because the N-2 is now 3.32, which means many packages are now being updated to a min Dart SDK of 3.8, triggering a formatter behavior change.6 个月前
README.md

google_identity_services_web

A JS-interop layer for Google Identity's Sign In With Google SDK.

See the original JS SDK reference:

Usage

This package is the Dart JS-interop layer of the new Sign In With Google SDK. Here's the API references for both of the sub-libraries:

Loading the SDK

There are two ways to load the JS SDK in your app.

Modify your index.html (most performant)

The most performant way is to modify your web/index.html file to insert a script tag as recommended. Place the script tag in the <head> of your site:

<head>
<!-- ··· -->
  <!-- Include the GSI SDK below -->
  <script src="https://accounts.google.com/gsi/client" async defer></script>
</head>

With the loadWebSdk function (on-demand)

An alternative way, that downloads the SDK on demand, is to use the loadWebSdk function provided by the library. A simple location to embed this in a Flutter Web only app can be the main.dart:

import 'package:google_identity_services_web/loader.dart' as gis;
// ···
void main() async {
  await gis.loadWebSdk(); // Load the GIS SDK
  // The rest of your code...
  // ···
}

(Note that the above won't compile for mobile apps, so if you're developing a cross-platform app, you'll probably need to hide the call to loadWebSdk behind a conditional import/export.)

Using the SDK

Once the SDK has been loaded, it can be used by importing the correct library:

  • import 'package:google_identity_services/id.dart'; for Authentication.
    • This will expose an id JSObject that binds to google.accounts.id.
  • import 'package:google_identity_services/oauth2.dart'; for Authorization.
    • This will expose an oauth2 JSObject that binds to google.accounts.oauth2.

Troubleshooting

Watch the browser's development tools JS console while using this package. Information about errors during initialization and use of the library will be displayed there.

Some common issues identified so far:

The given origin is not allowed for the given client ID

When you perform local tests or development, you must add both http://localhost and http://localhost:<port_number> to the Authorized JavaScript origins box. The Referrer-Policy response header must also be set to no-referrer-when-downgrade when using http and localhost.

Browser compatibility

The new SDK is introducing concepts that are on track for standardization to most browsers, and it might not be compatible with older browsers.

Refer to the official documentation site for the latest browser compatibility information of the underlying JS SDK: