spring-guides / tut-spring-boot-oauth2

Spring Boot and OAuth2:: A tutorial on "social" login and single sign on with Facebook and Github

Home Page:https://spring.io/guides/tutorials/spring-boot-oauth2/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JWT and Social Login Authentication

Danil0v3s opened this issue · comments

I'm trying to build a Spring Boot application that uses only Google and Facebook login and generate JWT tokens. This application will serve as a back-end for my app. I already have it running on NodeJS but I wanted to learn more about Spring Boot since it can be coded using Kotlin. The flow I'm using in my NodeJS server is the following:

  1. The user selects Facebook Login on the app and goes to facebook and it returns a Token;
  2. The app sends a request to the server in '/login/facebook' passing the Token somehow;
  3. The server checks if that token is valid by calling the Graph API '/me' request;
  4. If it's valid, then creates a new user, store it, authenticate and generate a JWT and send back to user.

But my problem is that I don't know what to search to achieve that. I don't want to someone to code everything for me and just send me the link, that would be great, but I want to learn, I'd like to know the steps I must take to make that work. Thanks in advance