An open API service indexing awesome lists of open source software.

https://github.com/leowebguy/google-oauth


https://github.com/leowebguy/google-oauth

Last synced: 6 days ago
JSON representation

Awesome Lists containing this project

README

          

# Google OAuth plugin for Craft

A minimal Craft plugin to provide Google OAuth login

---

## Installation

```bash
composer require "leowebguy/google-oauth" -w && php craft plugin/install google-oauth
```

## Composer

Craft 4

```json
"require": {
"leowebguy/google-oauth": "^1.0",
}
```

Craft 5

```json
"require": {
"leowebguy/google-oauth": "^2.0",
}
```

## Credentials

Gather the necessary info from GoogleOAuth

Go to https://console.cloud.google.com/auth/clients
1. Select a Project
2. Create client
3. Pick "Web application"

![Screenshot](resources/web-app.png)

4. Give it a name
5. Add "Authorized JavaScript origins" i.e. https://myapp.ddev.site (Optional)
6. Add "Authorized redirect URIs" i.e. https://myapp.ddev.site/oauth/g/auth

> The URI has to be "/oauth/g/auth"

> Added to your Craft App URL i.e. https://myapp.ddev.site/oauth/g/auth

![Screenshot](resources/console.png)

7. Copy Client ID and Secret
8. Paste/Save /admin/settings/plugins/google-oauth

![Screenshot](resources/settings.png)

9. Add ID/Secret to .env (Optional)

```.dotenv
### OAUTH
GOOGLE_CLIENT_ID=111-xxx.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=AAA-123qwe
```

![Screenshot](resources/main-login.png)

![Screenshot](resources/timeout-login.png)