add google oauth2
This commit is contained in:
33
google/README.MD
Normal file
33
google/README.MD
Normal file
@@ -0,0 +1,33 @@
|
||||
# Spring Boot + OAuth2 Google
|
||||
|
||||
<img alt="Spring Boot" width="auto" height="100" src="../docs/spring-boot.svg">
|
||||
<img alt="Discord" width="auto" height="100" src="docs/google.svg">
|
||||
|
||||
## Перед запуском
|
||||
### Создание OAuth
|
||||
Для запуска понадобиться обзавестить своим **Google OAuth**.
|
||||
|
||||
1. Переходим в [Google APIs console credentials](https://console.cloud.google.com/apis/credentials?project=silent-fuze-322306)
|
||||
2. Создаём новый OAuth Client ID
|
||||

|
||||
3. Заполняем обязательно следующие поля
|
||||
- **Application type**: `Web application`
|
||||
- **Homepage URL**: `http://127.0.0.1:8080`
|
||||
- **Authorization callback URL**: `http://127.0.0.1:8080/login/oauth2/code/google`
|
||||

|
||||
5. Получаем **Client secret/Client ID**
|
||||

|
||||
|
||||
### Настройка Spring
|
||||
Открываем файл `src/main/resources/application.yml` и указываем там **Client ID** и **Client secrets**:
|
||||
|
||||
```yaml
|
||||
spring:
|
||||
security:
|
||||
oauth2:
|
||||
client:
|
||||
registration:
|
||||
google:
|
||||
client-id: 704750524716-tnqc2islqao8tobjbrgvtte0fq8o39uv.apps.googleusercontent.com
|
||||
client-secret: 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
|
||||
```
|
||||
Reference in New Issue
Block a user