🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

@react-oauth/google

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-oauth/google - npm Package Compare versions

Comparing version

to
0.2.1

11

dist/index.d.ts

@@ -58,2 +58,9 @@ /// <reference types="react" />

itp_support?: boolean;
/**
* 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.
*/
hosted_domain?: string;
}

@@ -311,4 +318,6 @@ interface CredentialResponse {

promptMomentNotification?: MomenListener;
cancel_on_tap_outside?: boolean;
hosted_domain?: string;
}
declare function useGoogleOneTapLogin({ onSuccess, onError, promptMomentNotification, }: UseGoogleOneTapLoginOptions): void;
declare function useGoogleOneTapLogin({ onSuccess, onError, promptMomentNotification, cancel_on_tap_outside, hosted_domain, }: UseGoogleOneTapLoginOptions): void;

@@ -315,0 +324,0 @@ /**

@@ -150,3 +150,3 @@ import { jsx } from 'react/jsx-runtime';

function useGoogleOneTapLogin({ onSuccess, onError, promptMomentNotification, }) {
function useGoogleOneTapLogin({ onSuccess, onError, promptMomentNotification, cancel_on_tap_outside, hosted_domain, }) {
const { clientId, scriptLoadedSuccessfully } = useGoogleOAuth();

@@ -172,2 +172,4 @@ const onSuccessRef = useRef(onSuccess);

},
hosted_domain,
cancel_on_tap_outside,
});

@@ -179,3 +181,8 @@ (_b = window.google) === null || _b === void 0 ? void 0 : _b.accounts.id.prompt(promptMomentNotificationRef.current);

};
}, [clientId, scriptLoadedSuccessfully]);
}, [
clientId,
scriptLoadedSuccessfully,
cancel_on_tap_outside,
hosted_domain,
]);
}

@@ -182,0 +189,0 @@

@@ -154,3 +154,3 @@ 'use strict';

function useGoogleOneTapLogin({ onSuccess, onError, promptMomentNotification, }) {
function useGoogleOneTapLogin({ onSuccess, onError, promptMomentNotification, cancel_on_tap_outside, hosted_domain, }) {
const { clientId, scriptLoadedSuccessfully } = useGoogleOAuth();

@@ -176,2 +176,4 @@ const onSuccessRef = react.useRef(onSuccess);

},
hosted_domain,
cancel_on_tap_outside,
});

@@ -183,3 +185,8 @@ (_b = window.google) === null || _b === void 0 ? void 0 : _b.accounts.id.prompt(promptMomentNotificationRef.current);

};
}, [clientId, scriptLoadedSuccessfully]);
}, [
clientId,
scriptLoadedSuccessfully,
cancel_on_tap_outside,
hosted_domain,
]);
}

@@ -186,0 +193,0 @@

2

package.json
{
"name": "@react-oauth/google",
"version": "0.2.0",
"version": "0.2.1",
"description": "Google OAuth2 using Google Identity Services for React 🚀",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -8,7 +8,7 @@ # React OAuth2 | Google

```sh
$ npm install @react-oauth/google
$ npm install @react-oauth/google@latest
# or
$ yarn add @react-oauth/google
$ yarn add @react-oauth/google@latest
```

@@ -198,29 +198,30 @@

| Required | Prop | Type | Description |
| :------: | ---------------------------------- | ------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ✓ | onSuccess | `(response: CredentialResponse) => void` | Callback fires with credential response after successfully login |
| | onError | `function` | Callback fires after login failure |
| | type | `standard` \| `icon` | Button type [type](https://developers.google.com/identity/gsi/web/reference/js-reference#type) |
| | theme | `outline` \| `filled_blue` \| `filled_black` | Button [theme](https://developers.google.com/identity/gsi/web/reference/js-reference#theme) |
| | size | `large` \| `medium` \| `small` | Button [size](https://developers.google.com/identity/gsi/web/reference/js-reference#size) |
| | text | `signin_with` \| `signup_with` \| `continue_with` \| `signin` | Button [text](https://developers.google.com/identity/gsi/web/reference/js-reference#text). For example, "Sign in with Google", "Sign up with Google" or "Sign in" |
| | shape | `rectangular` \| `pill` \| `circle` \| `square` | Button [shape](https://developers.google.com/identity/gsi/web/reference/js-reference#shape) |
| | logo_alignment | `left` \| `center` | Google [logo alignment](https://developers.google.com/identity/gsi/web/reference/js-reference#logo_alignment) |
| | width | `string` | button [width](https://developers.google.com/identity/gsi/web/reference/js-reference#width), in pixels |
| | locale | `string | If set, then the button [language](https://developers.google.com/identity/gsi/web/reference/js-reference#locale) is rendered |
| | useOneTap | `boolean` | Activate One-tap sign-up or not |
| | 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 |
| | auto_select | `boolean` | Enables automatic selection on Google One Tap |
| | ux_mode | `popup` \| `redirect` | The Sign In With Google button UX flow |
| | login_uri | `string` | The URL of your login endpoint |
| | native_login_uri | `string | The URL of your password credential handler endpoint |
| | 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 |
| | 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 |
| | intermediate_iframe_close_callback | `function` | Overrides the default intermediate iframe behavior when users manually close One Tap |
| | itp_support | `boolean` | Enables upgraded One Tap UX on ITP browsers |
| Required | Prop | Type | Description |
| :------: | ---------------------------------- | ------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ✓ | onSuccess | `(response: CredentialResponse) => void` | Callback fires with credential response after successfully login |
| | onError | `function` | Callback fires after login failure |
| | type | `standard` \| `icon` | Button type [type](https://developers.google.com/identity/gsi/web/reference/js-reference#type) |
| | theme | `outline` \| `filled_blue` \| `filled_black` | Button [theme](https://developers.google.com/identity/gsi/web/reference/js-reference#theme) |
| | size | `large` \| `medium` \| `small` | Button [size](https://developers.google.com/identity/gsi/web/reference/js-reference#size) |
| | text | `signin_with` \| `signup_with` \| `continue_with` \| `signin` | Button [text](https://developers.google.com/identity/gsi/web/reference/js-reference#text). For example, "Sign in with Google", "Sign up with Google" or "Sign in" |
| | shape | `rectangular` \| `pill` \| `circle` \| `square` | Button [shape](https://developers.google.com/identity/gsi/web/reference/js-reference#shape) |
| | logo_alignment | `left` \| `center` | Google [logo alignment](https://developers.google.com/identity/gsi/web/reference/js-reference#logo_alignment) |
| | width | `string` | button [width](https://developers.google.com/identity/gsi/web/reference/js-reference#width), in pixels |
| | locale | `string` | If set, then the button [language](https://developers.google.com/identity/gsi/web/reference/js-reference#locale) is rendered |
| | useOneTap | `boolean` | Activate One-tap sign-up or not |
| | 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 |
| | auto_select | `boolean` | Enables automatic selection on Google One Tap |
| | ux_mode | `popup` \| `redirect` | The Sign In With Google button UX flow |
| | login_uri | `string` | The URL of your login endpoint |
| | native_login_uri | `string` | The URL of your password credential handler endpoint |
| | 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 |
| | 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 |
| | intermediate_iframe_close_callback | `function` | Overrides the default intermediate iframe behavior when users manually close One Tap |
| | 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 |

@@ -257,6 +258,8 @@ ### useGoogleLogin (Both implicit & authorization code flow)

| Required | Prop | Type | Description |
| :------: | ------------------------ | -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| ✓ | onSuccess | `(response: CredentialResponse) => void` | Callback fires with credential response after successfully login |
| | onError | `function` | Callback fires after login failure |
| | promptMomentNotification | `(notification: PromptMomentNotification) => void` | [PromptMomentNotification](https://developers.google.com/identity/gsi/web/reference/js-reference) methods and description |
| Required | Prop | Type | Description |
| :------: | ------------------------ | -------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ✓ | onSuccess | `(response: CredentialResponse) => void` | Callback fires with credential response after successfully login |
| | onError | `function` | Callback fires after login failure |
| | 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 |