开发者

Integrate Lift ProtoUser with Facebook Login / SSO

开发者 https://www.devze.com 2023-03-16 21:18 出处:网络
I\'m writing a web-based app (hoping to using Lift) and would like to have users log into my system using their Facebook credentials.I also plan to have a user table so that I can track the users who

I'm writing a web-based app (hoping to using Lift) and would like to have users log into my system using their Facebook credentials. I also plan to have a user table so that I can track the users who perform action开发者_高级运维s on my site.

  1. If this is the first time the user has logged in, then create a new User object (extend Lift's ProtoUser), persist that user to the database, and set that user as the current user for this session.
  2. If this is a returning user, then retrieve the registered user from the database, and set that user as the current user for this session.

Has anyone done this type of user integration before in Lift and can provide some guidance or even source code to achieve this? Thanks.


In order to get user access token do following roughly:

  1. Create a Facebook app
  2. On your lift web create a button and when an user clicks it redirect the user to facebook ouath dialog with properly configured parameters such app_id, redirect_uri,permission ...
  3. After user authorizes your app it will redirect to your page with user access token. I think facebook attaches the access token in redirect url if I'm not wrong. Get the access token and you know what to do next.


This repo on github: https://github.com/dahdahm/lift_authentication_starter contains a sample that shows loggin in through facebook and openid.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号