简体   繁体   English

iOS Facebook SDK访问令牌

[英]iOS Facebook SDK access token

I am experimenting with an iOS app that utilize a REST API (ASP.NET MVC Web API) and I want users to be able to logon/register using either: 我正在尝试使用REST API(ASP.NET MVC Web API)的iOS应用,我希望用户能够使用以下任一方式登录/注册:

  • Username and password (default) 用户名和密码(默认)
  • Facebook authentication Facebook认证

I have setup the iOS Facebook SDK and users can logon/register using it. 我已经安装了iOS Facebook SDK,用户可以使用它登录/注册。

When a user register with Facebook, what access token should be used to bind it with the REST API account? 当用户在Facebook中注册时,应使用什么访问令牌将其与REST API帐户绑定? AKFAccessToken or FBSDKAccessToken? AKFAccessToken或FBSDKAccessToken?

Haven´t found any tutorials where an iOS app and ASP.NET MVC Web API is combined. 还没有找到将iOS应用程序和ASP.NET MVC Web API相结合的教程。 If anyone knows where I can find one that would help a lot. 如果有人知道我在哪里可以找到一个很大的帮助。

If I am going at this problem completely wrong please correct me, I am still trying to wrap my head around it. 如果我要彻底解决此问题,请纠正我,但我仍在努力解决问题。

I will mention in details the best practice I know. 我将详细介绍我所知道的最佳实践。 The server have the facebook App ID (special ID for the app given from facebook when you register your new app). 服务器具有facebook应用ID(注册新应用时从facebook提供的应用的特殊ID)。 You send the FBSDKAccessToken for the server the server will encrypt the FBSDKAccessToken with the app id as a key and return to you the result named 'AccessKey'. 您向服务器发送FBSDKAccessToken,服务器将使用应用程序ID作为密钥对FBSDKAccessToken进行加密,然后将名为“ AccessKey”的结果返回给您。

You save the accesskey and use it as a relation with the server from now on. 从现在开始,您保存访问密钥并将其用作与服务器的关系。

This way, no one can know the userFBID since u encrypted it and you didnt share your facebook app ID since it should be a secret. 这样,由于您已对userFBID进行了加密,因此没有人知道它,并且您没有共享Facebook应用程序ID,因为它应该是秘密。

Hope this helps! 希望这可以帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM