Spring boot OAuth2 + mobile client (password and FB login)

Viewed 1195

I am developing a REST API with Spring Boot. I have implemented OAuth2 authorization server, so I am able to call my rest API to get a token:

localhost:8080/oauth/token -d "grant_type=password&scope=write&username=myuser&password=mypassword" -u myclient:mysecret

Now I want to implement "Sign up with FB" functionality, so I am thinking about the following flow:

  1. User clicks on the "Sign up with FB" button.
  2. Mobile app app makes a call to FB and gets an Access Token from FB
  3. Mobile app sends this access token to the backend
  4. Backend creates a new user entity and sends back a new access token (together with refresh token) issued by authorization server.

But I am not sure how to implement the step 4. I tried to find an example on internet, but didn't have any luck. Does anybody have an idea how to implement it?

Here is my OAuth2 implementation: https://gist.github.com/osgafarov/8530464d25895512862a3d1f6013170e

Many thanks!

1 Answers
Related