MVC4 oauth facebook, access to user and friend permissions:

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

I created a new application on facebook and set some additional requirements regarding permissions for users email address / location and birthday.

I saved the changes inside fb, and by clicking on the preview dialog, I see additional permissions that I want to display in the preview window.

When I try to authenticate with facebook, they don't ask me if I allow additional fields that I set up in facebook.

Is there anything else in my mvc application that needs to be changed in order to transfer these additional requirements to facebook?

Thanks for any help.

+6
source share
3 answers

It seems that you need 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 as well as http: //blog.mrroa .com / post / 30454808112 / asp-net-custom-linkedin-oauth-provider

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

Here I use facebook C # sdk to request additional permissions before calling CreateOrUpdateAccount .

I do not think this is the best solution, but it works.

+3
source

I created a new application on facebook and set some additional requirements regarding permissions for users email address / location and birthday.

I saved the changes inside fb, and by clicking on the preview dialog, I see additional permissions that I want to display in the preview window.

When I try to authenticate with facebook, they don't ask me if I allow additional fields that I set up in facebook.

It looks like you're another one who is confused about what Authenticated Referrals actually do. (The permission fields in the settings of your application apply only to these parameters!)

Authenticated referrals come into play when a user clicks on any link redirecting your application to Facebook.

If you make your login yourself, you need to request the necessary permissions using the scope parameter.

+1
source

Unfortunately, if you use ILSpy in the FacebookClient class that ships with MVC 4, you can see that the MS code just doesnโ€™t request information by email, even if the base DotNetOpenAuth classes support it.

Therefore, you need to implement your own FacebookClient class, which does almost the same thing, but adds the requested elements to the email address. I am trying it myself right now and hope that it will work soon.

0
source

Source: https://habr.com/ru/post/923756/


All Articles