1
votes

Apologies, I work predominantly with iOS lately, and its been a while since I've worked with Spring.

Tools:

  • Kotlin
  • Spring Boot
  • Spring Social

Problem:

I'm building an app that allows typical 'Login with Facebook' type functionality.

I'd like to send the OAuth token obtained by the iOS client to the backend to authenticate with. If the token is valid, the backend will return successful authentication, otherwise indicate invalid credentials.

After logging in with the OAuth token, some profile information will be retrieved.

Question:

Most of the Get Started guides seem to follow the authentication with OAuth using username and password credentials.

Using Spring Social+Facebook, how can I:

  • Authenticate using an OAuth access token and retrieve profile data?
1
@farrellmr thanks for the (removed?) answer - looks like that's all I needed. Will try soon. - Jasper Blues

1 Answers

0
votes

It is simple - Spring's FacebookTemplate can be instantiated with an oauth access token as follows:

val facebook = FacebookTemplate("$$TOKEN$$")