Back to directory
ScottEAdams

payload plugin google one tap

by ScottEAdams
v1
^1.1.15
MIT

From the author

Adds Google One Tap login to Payload CMS

Installation

npm i payload-plugin-google-one-tap

13

Stars

1

Forks

1

Open Issues

3 years ago

Last Updated

1

Weekly Downloads

v1.0.7

npm Version

47.6 KB

Unpacked Size

5

Dependencies

GitHub stars

Trends appear after 7 days of data. Daily snapshots have not started yet.

npm weekly downloads

Trends appear after 7 days of data. Daily snapshots have not started yet.

Each point is npm's rolling 7-day download count.

Health Score

0/100Archived

Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.

Badge for your README

Payload Directory health badge
Markdown
[![Payload Directory](https://payloaddirectory.dev/badge/555615120-root.svg)](https://payloaddirectory.dev/plugins/555615120-root)
HTML
<a href="https://payloaddirectory.dev/plugins/555615120-root"><img src="https://payloaddirectory.dev/badge/555615120-root.svg" alt="Payload Directory"></a>
Updated Nov 22, 2022Created Oct 21, 2022Published Nov 22, 2022

README

# payload-plugin-google-one-tap

Adds google-one-tap functionality to the login page.

## Installation

```
yarn add payload-plugin-google-one-tap
```

You will need to add your google credentials as environment variables:
```dotenv
PAYLOAD_PUBLIC_GOOGLE_CLIENT_ID=your-client-id.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=your-google-secret
```

Then you can add the plugin to your payload.config:

```js
import { googleOneTap } from 'payload-plugin-google-one-tap'
Full README
# payload-plugin-google-one-tap

Adds google-one-tap functionality to the login page.

## Installation

```
yarn add payload-plugin-google-one-tap
```

You will need to add your google credentials as environment variables:
```dotenv
PAYLOAD_PUBLIC_GOOGLE_CLIENT_ID=your-client-id.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=your-google-secret
```

Then you can add the plugin to your payload.config:

```js
import { googleOneTap } from 'payload-plugin-google-one-tap'

export default buildConfig({
    ...
    plugins: [googleOneTap()],
    ...
})
```

This package uses the following libraries:

https://github.com/MomenSherif/react-oauth

https://github.com/Genially/passport-google-one-tap

You will need to add the following webpack config:

```js
    admin: {
		webpack: (config) => ({
			...config,
			resolve: {
				...config.resolve,
				fallback: {
					...config.resolve.fallback,
					util: require.resolve('util'),
					stream: require.resolve('stream-browserify'),
					fs: false,
					url: false,
					querystring: false,
					child_process: false,
					assert: false,
					tls: false,
					net: false,
					os: false
				}
			}
		})
	}
```

And finally you will need to add the following to your server.ts file:
```js
const app = express()

app.use(express.json())
```

You can customise the login button if you like by passing in some props in your payload.config.ts. Heres the defaults:

```js
plugins: [
	googleOneTap({
		type: 'standard',
		theme: 'outline',
		size: 'large',
		text: 'signin_with',
		shape: 'rectangular',
		logo_alignment: 'left',
		width: undefined, // auto,
		locale: undefined,
		useOneTap: true,
		auto_select: false,
		ux_mode: 'popup'
	})
]
```

Similar plugins