jerry80409 / spring-boot-facebook-oauth

A Spring-boot framework demo for facebook login flow

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Facebook OAuth Login Example

Spring-boot demo for facebook oauth login. Reference by facebook manually-build-a-login-flow.

Step1. Generate facebook oauth login url

The REST resource of /api/facebook/user/login will be generate a facebook oauth login url, you can pass with perms parameter, perms means facebook login permissions, can ref facebook permissions,

curl -XGET "http://localhost:8888/api/facebook/user/login?perms=public_profile,email,friends"

Step2. Setting facebook app for oauth redirect uri

when client click the oauth login url, facebook will send a request to /api/facebook/oauth/callback, you must be setting Valid OAuth redirect URIs on your facebook app dashboard. alt app-dashboard

Step3. Handle facebook oauth login callback

The REST resource of /api/facebook/oauth/callback will handle the facebook callback, You must implement verify state parameter to defend dangerous request. then pass code parameter to request facebook user's access_token, ref by Exchanging Code for an Access Token

enjoy

English is not my native language; I try my best.

About

A Spring-boot framework demo for facebook login flow


Languages

Language:Java 39.0%Language:Shell 33.9%Language:Batchfile 26.2%Language:HTML 0.9%