본문 바로가기
OAuth/Google Login API

[Google Login API] 개발환경 구성 및 Spring Boot 프로젝트 생성 (Spring Boot 레퍼런스를 보면서 구현해보는 구글 소셜 로그인 REST API - 2)

by 임채훈 2020. 10. 18.

Spring Boot 환경에서 구글 소셜 로그인 API를 REST 방식으로 구현하기

이전글

2020/10/18 - [OAuth/Google Login API] - [Google Login API] Google APIs 신규 프로젝트 생성 및 개발환경 구성 (Spring Boot 레퍼런스를 보면서 구현해보는 구글 소셜 로그인 REST API - 1)

 

[Google Login API] Google APIs 신규 프로젝트 생성 및 개발환경 구성 (Spring Boot 레퍼런스를 보면서 구현�

Spring Boot 환경에서 구글 소셜 로그인 API를 REST 방식으로 구현하기 지난번 카카오 소셜 로그인 API에 이어 ( 1년반이 지나서 ... ) Spring Boot 환경에서 카카오 로그인 API RESTful방식으로 연동하기 -1장).

antdev.tistory.com

 

Step

  1. Google APIs 신규 프로젝트 생성 및 개발환경 구성
    1. 새 프로젝트 생성
    2. OAuth 동의 화면 구성
    3. API Key 생성
    4. OAuth 클라이언트 ID 생성(사용자 인증 정보 생성)
  2. 개발환경 구성 및 Spring Boot 프로젝트 생성
    1. 개발환경
    2. Spring Boot 프로젝트 생성
  3. 소셜 로그인 요청 Redirect 처리 (로그인 최초 요청 처리)
  4. 소셜 로그인 요청 Redirect 처리 - 2
  5. 구글 로그인 Access Token 및 Refresh Token 발급

2. 개발환경 구성 및 Spring Boot 프로젝트 생성

1. 개발환경

  • Spring Boot 2.3.4
  • Maven
  • Library
    • Spring Boot DevTools
    • Lombok
    • Spring Web
  • 기타 유틸리티
    • Postman (HTTP 요청 테스트 용도)

2. Spring Boot 프로젝트 생성

  • 패키지 구조

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.3.4.RELEASE</version>
        <relativePath/>
    </parent>
    <groupId>org.project</groupId>
    <artifactId>oauth</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>
    <name>oauth</name>
    <description>Oauth project for Spring Boot</description>

    <properties>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.junit.vintage</groupId>
                    <artifactId>junit-vintage-engine</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>

 

다음장에 이어서

2020/10/18 - [OAuth/Google Login API] - [Google Login API] 소셜 로그인 요청 Redirect 처리 (Spring Boot 레퍼런스를 보면서 구현해보는 구글 소셜 로그인 REST API - 3)


혹시나 오류가 발생하거나 질문할 사항이 있으시면 댓글 및 카카오톡 1:1 오픈채팅을 통해서 문의해주시면 친절하게 알려드리겠습니다~!

 

지나가던 백엔드 개발자

 

open.kakao.com

전체 소스코드는 개인 Github에 올려두었습니다.

 

youspend8/google-login-api-sample-blog

Contribute to youspend8/google-login-api-sample-blog development by creating an account on GitHub.

github.com

댓글