Using iOS 6 social.Framework (twitter oauth) to login to an ASP.NET MVC 4 site

£可爱£侵袭症+ 提交于 2019-12-11 05:31:01

问题


I have a site built using ASP.NET MVC 4 with its built-in login OAuth integration to Twitter.

I also have an iOS native app that uses social.Framework and twitter's reverse auth to get an oauth token+secret for a twitter account stored on the device.

How can use the iOS credentials to pages and web services hosted on my ASP.NET MVC 4 site?


回答1:


  1. In AccountController.cs, clone ExternalLoginCallback action method with a different url and add oath_token and oauth_token_secret method parameters.
  2. Remove the VerifyAuthentication call and check.
  3. Check to see if User.Identity.IsAuthenticated, if so, WebSecurity.Logout() and return Redirect(Request.Url.ToString()).
  4. Call Twitter's /account/verify_credentials.json (signed) to validate the oauth token and get the screen_name. Make sure you use RFC3896 encoding (eg. %2B not %2b) or it won't work.
  5. Replace result.Provider with "twitter".
  6. Replace result.ProviderUserId with screen_name.


来源:https://stackoverflow.com/questions/15095077/using-ios-6-social-framework-twitter-oauth-to-login-to-an-asp-net-mvc-4-site

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!