An Interest In:
Web News this Week
- April 24, 2024
- April 23, 2024
- April 22, 2024
- April 21, 2024
- April 20, 2024
- April 19, 2024
- April 18, 2024
November 20, 2021 05:12 pm GMT
Note:-
Original Link: https://dev.to/rohan2596/how-to-implement-oauth-login-single-sign-on-using-google-javaspring-boot-part-2-5cl1
How to implement OAuth Login (Single Sign-on) using Google & Java(Spring Boot) Part 2
OAuth2 Google
Hello All, Its Rohan Kadam
In previous part 1, we looked into how to create projects and keys and credentials. Let us look into code for implementing OAuth Login in Spring boot
Follow the below article for Google Configuration.
How to implement OAuth2 Login Using Google Part 1
Step 1:- Create a Spring Boot Project using Spring initializer.
Step 2:- Add the following dependencies in your project pom.xml
<dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-oauth2-client</artifactId></dependency>
Step 3:- Create a Configuration File for implementing OAuth2.
Step 4:- Create Application Yml which will consist of Google Configuration.
Step 5:- Create a Rest Controller which consists of two endpoints.
Note:-
Principal Object contains username, email and profile image depending on scope.
If an error occurs regarding an incorrect redirect Url add the following URL **https://localhost:8080/oauth2/callback/google**
Original Link: https://dev.to/rohan2596/how-to-implement-oauth-login-single-sign-on-using-google-javaspring-boot-part-2-5cl1
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To