From e050852f078bde7c51a5e2211080ee0adf030526 Mon Sep 17 00:00:00 2001 From: tadcom0 Date: Thu, 18 Dec 2025 12:59:45 +0100 Subject: [PATCH 1/3] fix(GoogleLogin): add state property --- packages/@react-oauth/google/src/GoogleLogin.tsx | 2 ++ packages/@react-oauth/google/src/types/index.ts | 2 ++ 2 files changed, 4 insertions(+) diff --git a/packages/@react-oauth/google/src/GoogleLogin.tsx b/packages/@react-oauth/google/src/GoogleLogin.tsx index dc8777b..8f16dac 100644 --- a/packages/@react-oauth/google/src/GoogleLogin.tsx +++ b/packages/@react-oauth/google/src/GoogleLogin.tsx @@ -35,6 +35,7 @@ export default function GoogleLogin({ width, locale, click_listener, + state, containerProps, ...props }: GoogleLoginProps) { @@ -80,6 +81,7 @@ export default function GoogleLogin({ width, locale, click_listener, + state, }); if (useOneTap) diff --git a/packages/@react-oauth/google/src/types/index.ts b/packages/@react-oauth/google/src/types/index.ts index f880f66..3ce8672 100644 --- a/packages/@react-oauth/google/src/types/index.ts +++ b/packages/@react-oauth/google/src/types/index.ts @@ -100,6 +100,8 @@ export interface GsiButtonConfiguration { locale?: string; /** If set, this [function](https://developers.google.com/identity/gsi/web/reference/js-reference#click_listener) will be called when the Sign in with Google button is clicked. */ click_listener?: () => void; + /** If set, this [string](https://developers.google.com/identity/gsi/web/reference/js-reference#state) returns with the ID token. */ + state?: string; } export interface PromptMomentNotification { From a89c7fb3f18de21f7ff6b36254abb7ff7c685fb0 Mon Sep 17 00:00:00 2001 From: tadcom0 Date: Thu, 18 Dec 2025 13:07:24 +0100 Subject: [PATCH 2/3] fix(GoogleLogin): add property to readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 3c2db68..4877748 100644 --- a/README.md +++ b/README.md @@ -221,6 +221,7 @@ const hasAccess = hasGrantedAnyScopeGoogle( | | native_callback | `(response: { id: string; password: string }) => void` | The JavaScript password credential handler function name | | | prompt_parent_id | `string` | The DOM ID of the One Tap prompt container element | | | nonce | `string` | A random string for ID tokens | +| | state | `string` | This string returns with the ID token | | | context | `signin` \| `signup` \| `use` | The title and words in the One Tap prompt | | | state_cookie_domain | `string` | If you need to call One Tap in the parent domain and its subdomains, pass the parent domain to this attribute so that a single shared cookie is used | | | allowed_parent_origin | `string` \| `string[]` | The origins that are allowed to embed the intermediate iframe. One Tap will run in the intermediate iframe mode if this attribute presents | From fcab8508539727025665a893588b25784df64ea0 Mon Sep 17 00:00:00 2001 From: tadcom0 Date: Thu, 18 Dec 2025 13:18:23 +0100 Subject: [PATCH 3/3] fix(GoogleLogin): add change set --- .changeset/tiny-singers-swim.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/tiny-singers-swim.md diff --git a/.changeset/tiny-singers-swim.md b/.changeset/tiny-singers-swim.md new file mode 100644 index 0000000..dcd6d10 --- /dev/null +++ b/.changeset/tiny-singers-swim.md @@ -0,0 +1,5 @@ +--- +'@react-oauth/google': minor +--- + +Added natively supported state property to GoogleLogin component