Store and retrieve the token received for the user after authorizing with facebook or twitter

前端 未结 1 1075
礼貌的吻别
礼貌的吻别 2020-12-30 17:06

Hi I\'m currently trying to write an MVC5 application that will have the ability to store the token received for the user after authorizing with facebook or twitter.

相关标签:
1条回答
  • 2020-12-30 18:05

    So if I understand your question correctly, you want to persist the facebook access token into your user database so you can use it again later?

    So you can start by looking at this related question: How to access facebook data

    Once you get the access token, I would actually just save this as a custom user claim for your user:

    manager.AddClaim(userId, new Claim("facebookAccessToken", fbAccessToken"));
    

    And then when you want to use it later, you can get it out from the ClaimsIdentity for the logged in user (User.Identity)

    0 讨论(0)
提交回复
热议问题