0
Files
spring-oauth2-examples/github/README.MD

34 lines
1.2 KiB
Markdown

# Spring Boot + OAuth2 GitHub
<img alt="Spring Boot" width="auto" height="100" src="../docs/spring-boot.svg">
<img alt="Discord" width="auto" height="100" src="docs/github-white.svg">
## Перед запуском
### Создание OAuth App
Для запуска понадобиться обзавестить своим **GitHub OAuth App**.
1. Переходим в [Developer settings](https://github.com/settings/developers)
2. Создём новое OAuth приложение
![](docs/1.png)
3. Заполняем обязательно следующие поля
- **Homepage URL**: `http://127.0.0.1:8080`
- **Authorization callback URL**: `http://127.0.0.1:8080/login/oauth2/code/github`
![](docs/2.png)
4. Сгенерировать новый **Client secrets**
![](docs/3.png)
![](docs/4.png)
### Настройка Spring
Открываем файл `src/main/resources/application.yml` и указываем там **Client ID** и **Client secrets**:
```yaml
spring:
security:
oauth2:
client:
registration:
github:
client-id: f9bbf16cc3a93663282f
client-secret: 16f203668e25bfe44513d2a7b4925d62bb100783
```