开发者

Facebook connect database transaction help

I am trying to implement a simple login system with facebook, but I need users to pick a username. What I was thinking was to get all the information I need from facebook, request permissions, then add the information to the database, redirect to a form asking for a username and then add that to the database, to the same entry.

I think a transaction is needed so I don't end up with any half completed database entries. But I've only ever used them on the same page, so I'm wondering if this is safe? If it fails then there is no point where I would be telling the database to roll bac开发者_运维问答k the changes and it would be with a transaction open.

Is this right or will it be ok?


I think you made it more complicated than it should be :)

No need to enter facebook id into database before username as you can always grab it later.

  • Forward user to login screen (or better just open login popup using javascript FB API)
  • Once user is logged in forward them to username picking page (or better do javascript popup without page redirect)
  • When user is entered username request the current user id from facebook on server side (by either using graph api or fql) and then if everything is ok enter this record to database.
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜