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

37 lines
1.4 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Spring Boot + OAuth2 Discord
<img alt="Spring Boot" width="auto" height="100" src="../docs/spring-boot.svg">
<img alt="Discord" width="auto" height="100" src="docs/discord-app.png">
## Перед запуском
### Создание Discord Application
Для запуска понадобиться обзавестить своим **Discord Application**.
1. Переходим на [Discord Developer Portal](https://discord.com/developers/applications)
2. Создаём новое приложение
![](docs/1.png)
3. Переходим в раздел OAuth2
![](docs/2.png)
4. Добавляем адрес `http://127.0.0.1:8080/login/oauth2/code/discord` как адрес переадресации при успешной авторизации
![](docs/3.png)
![](docs/4.png)
5. Создаём **Client Secret**
![](docs/5.png)
![](docs/6.png)
6. Не забываем сохранить внесённые изменения!
![](docs/7.png)
### Настройка Spring
Открываем файл `src/main/resources/application.yml` и указываем там **Client ID** и **Client Secret**,
которые были указаны в разделе **OAuth2**:
```yaml
spring:
security:
oauth2:
client:
registration:
discord:
client-id: 965013316982423632
client-secret: yhb13RP26WxfOru9fcQ6CxPcAUWr_2q6
```