0
Files
spring-oauth2-examples/google/README.MD
2022-04-21 19:44:28 +03:00

1.3 KiB

Spring Boot + OAuth2 Google

Spring Boot Google

Перед запуском

Создание OAuth

Для запуска понадобиться обзавестить своим Google OAuth.

  1. Переходим в Google APIs console credentials
  2. Создаём новый OAuth Client ID
  3. Заполняем обязательно следующие поля
    • Application type: Web application
    • Name: MY-GOOGLE-APP
    • Authorization callback URL: http://127.0.0.1:8080/login/oauth2/code/google
  4. Получаем Client secret/Client ID

Настройка Spring

Открываем файл src/main/resources/application.yml и указываем там Client ID и Client secrets:

spring:
  security:
    oauth2:
      client:
        registration:
          google:
            client-id: 704750524716-tnqc2islqao8tobjbrgvtte0fq8o39uv.apps.googleusercontent.com
            client-secret: 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