Skip to content

Commit

Permalink
feat: make use_fedcm_for_prompt optional
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Make use_fedcm_for_prompt optional
  • Loading branch information
i7N3 committed Nov 18, 2023
1 parent f5f7e15 commit 52a37bd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ A user-friendly API for GIS SDK, using the new [**Google Identity Services SDK**
- 🕊 Dependency free
- 🔑 Fully Typed APIs
- 💡 Framework agnostic
- [Supports FedCM](https://developers.google.com/identity/gsi/web/guides/fedcm-migration)
- [FedCM Support](https://developers.google.com/identity/gsi/web/guides/fedcm-migration)

## Install

Expand Down Expand Up @@ -201,6 +201,7 @@ const hasAccess = hasGrantedAnyScopeGoogle(
| | promptMomentNotification | `(notification: PromptMomentNotification) => void` | [PromptMomentNotification](https://developers.google.com/identity/gsi/web/reference/js-reference) methods and description |
| | cancel_on_tap_outside | `boolean` | Controls whether to cancel the prompt if the user clicks outside of the prompt |
| | hosted_domain | `string` | If your application knows the Workspace domain the user belongs to, use this to provide a hint to Google. For more information, see the [hd](https://developers.google.com/identity/protocols/oauth2/openid-connect#authenticationuriparameters) field in the OpenID Connect docs |
| | use_fedcm_for_prompt | `boolean` | Allow the browser to control user sign-in prompts and mediate the sign-in flow between your website and Google. Defaults to false. See [Migrate to FedCM](https://developers.google.com/identity/gsi/web/guides/fedcm-migration) page for more information. |

### useRenderButton

Expand Down Expand Up @@ -234,6 +235,7 @@ const hasAccess = hasGrantedAnyScopeGoogle(
| | itp_support | `boolean` | Enables upgraded One Tap UX on ITP browsers |
| | hosted_domain | `string` | If your application knows the Workspace domain the user belongs to, use this to provide a hint to Google. For more information, see the [hd](https://developers.google.com/identity/protocols/oauth2/openid-connect#authenticationuriparameters) field in the OpenID Connect docs |
| | click_listener | `function` | 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. |
| | use_fedcm_for_prompt | `boolean` | Allow the browser to control user sign-in prompts and mediate the sign-in flow between your website and Google. Defaults to false. See [Migrate to FedCM](https://developers.google.com/identity/gsi/web/guides/fedcm-migration) page for more information. |

## How to develop?

Expand Down
4 changes: 2 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ export default class GoogleOAuthProvider {

window.google?.accounts.id.initialize({
hosted_domain,
use_fedcm_for_prompt,
cancel_on_tap_outside,
client_id: this.clientId,
use_fedcm_for_prompt: use_fedcm_for_prompt ?? true,
callback: (credentialResponse: GoogleCredentialResponse) => {
if (!credentialResponse?.credential && onError) {
return onError();
Expand Down Expand Up @@ -174,7 +174,7 @@ export default class GoogleOAuthProvider {

window.google?.accounts.id.initialize({
client_id: this.clientId,
use_fedcm_for_prompt: use_fedcm_for_prompt ?? true,
use_fedcm_for_prompt,
callback: (credentialResponse: GoogleCredentialResponse) => {
if (!credentialResponse?.credential && onError) {
return onError();
Expand Down
5 changes: 0 additions & 5 deletions src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ export interface IdConfiguration {
/**
* Allow the browser to control user sign-in prompts
* and mediate the sign-in flow between your website and Google.
*
* @default true
*/
use_fedcm_for_prompt?: boolean;
}
Expand Down Expand Up @@ -481,9 +479,6 @@ export interface UseGoogleOneTapLoginOptions {
promptMomentNotification?: MomenListener;
cancel_on_tap_outside?: boolean;
hosted_domain?: string;
/**
* @default true
*/
use_fedcm_for_prompt?: boolean;
}

Expand Down

0 comments on commit 52a37bd

Please sign in to comment.