37 lines
1.5 KiB
Markdown
37 lines
1.5 KiB
Markdown
# Spring Boot + OAuth2 Discord
|
||
|
||
<img alt="Spring Boot" width="auto" height="100" src="https://spring.io/images/spring-initializr-4291cc0115eb104348717b82161a81de.svg">
|
||
<img alt="Discord" width="auto" height="100" src="https://www.freepngimg.com/thumb/computer/94317-teamspeak-discord-servers-computer-facial-smile-expression.png">
|
||
|
||
## Перед запуском
|
||
### Создание Discord Application
|
||
Для запуска понадобиться обзавестить своим **Discord Application**.
|
||
|
||
1. Переходим на [Discord Developer Portal](https://discord.com/developers/applications)
|
||
2. Создаём новое приложение
|
||

|
||
3. Переходим в раздел OAuth2
|
||

|
||
4. Добавляем адрес `http://127.0.0.1:8080/login/oauth2/code/discord` как адрес переадресации при успешной авторизации
|
||

|
||

|
||
5. Создаём **Client Secret**
|
||

|
||

|
||
6. Не забываем сохранить внесённые изменения!
|
||

|
||
|
||
### Настройка 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
|
||
```
|