MVC4 oauth facebook accessing User & Friend Permissions:

后端 未结 3 392
伪装坚强ぢ
伪装坚强ぢ 2021-01-05 18:21

Using the new mvc4 now gives us access to use facebook oauth otb.

I have created a new app within facebook and have set some extra requirements around asking permiss

相关标签:
3条回答
  • 2021-01-05 18:28

    I have created a new app within facebook and have set some extra requirements around asking permission for the users email address/location & birthday.

    I have saved the changes within fb and when clicking on the preview auth dialog I can see the extra permissions I want displayed within the preview window.

    When I try authenticate against facebook I am not asked if I give permission to the extra fields I setup within facebook.

    This sounds like you are another one that’s confused about what Authenticated Referrals actually do. (The permission fields in your app settings apply to those only!)

    Authenticated Referrals come into play, when a user clicks on any link redirecting to your app on Facebook.

    If you are doing the login yourself, however – you have to ask for the permissions you want using the scope parameter.

    0 讨论(0)
  • Unfortunately if you use ILSpy on the FacebookClient class that ships with MVC 4 you can see that the MS code simply doesn't request the email info even though the underlying DotNetOpenAuth classes support it.

    You therefore need to implement your own FacebookClient class which does pretty much the same thing but adds in the email address to the requested items. I am attempting this myself right now and hope to have it working soon.

    0 讨论(0)
  • 2021-01-05 18:34

    It seems that you have to write your own custom provider. If so, you should look at http://blogs.msdn.com/b/webdev/archive/2012/08/23/plugging-custom-oauth-openid-providers.aspx and http://blog.mrroa.com/post/30454808112/asp-net-custom-linkedin-oauth-provider

    What I do is : In AccountController : - I add using Facebook; (facebook.dll from www.csharpsdk.org) also in AccountController, find in ExternalLoginCallback:

    Here, i use the facebook c# sdk to ask for extra permissions before invoking CreateOrUpdateAccount.

    I don't think this is the best solution but it works.

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