Permissions for application

主宰稳场 提交于 2019-12-11 06:03:47

问题


I set User & Friend Permissions on my application, to get user email on website. I get this info when I click Preview Login Dialog:

THIS APP WILL RECEIVE:

Your basic info
Your email address (xyz@xyz.com)
Your birthday
Your relationship details
Your photos

when I tried to log in on my website, application needs only this information:

THIS APP WILL RECEIVE:

Your basic info

Why? Why doesn't the main application have the same permissions as the preview?

Regards

EDIT:

I'm using Auth from this tutorial: http://www.asp.net/mvc/tutorials/mvc-4/using-oauth-providers-with-mvc - and code has not changed in my project.
Honestly, I don't want to change authorization methods, because I also want to provide Twitter login, and this mechanism is perfect for me.
I just want to add for Facebook "scope=email,publish_stream".

I discovered, that when I put this query manually when my website redirect me to facebook application (&scope=email,publish_stream), everything works perfect. Is there any solution to do this on back-code?


回答1:


The app detail page in the App Center displays the permissions required for new users. It can be considered a version of the Login Dialog in this capacity, making it easy for new users to install your app directly from the App Center. You can configure the set of permissions your app requires in the Settings > Permissions tab.

Source: https://developers.facebook.com/docs/guides/appcenter/#authorization

So, these permission settings only apply when you've got an app in the App Center to configure, which case it is useful to:

  • show what permissions the user will be asked before the user decides to use the app,
  • avoid any additional Login Dialog.

Because your app don't (I guess) figure in the App Center, you have to ask for permissions using the usual way: from the code. To do so, read: How to use user permissions with Facebook C# SDK

Edit: Forget about the App Center for now. It is the last step you should do. The App Center gathers great and famous apps only, which all work perfectly and that Facebook employees need to accept:

Not all apps will appear in the App Center, and we reserve the right to remove apps that do not meet a high quality bar. Once you’ve created your app detail page, we’ll review it and your app to make sure it meets our eligibility, submission, and quality guidelines.

So, asking for your app to appear on the App Center really is the last thing you should think about.




回答2:


Problem solved!

If you are using this tutorial : http://www.asp.net/mvc/tutorials/mvc-4/using-oauth-providers-with-mvc

Insert in your Package manager console this command update-package DotNetOpenAuth.Core

Now your application will automatically ask for user e-mail - you don't have to change anything.
Here you will find result - result.UserName




回答3:


Stéphane Bruckert is right, the permissions you add in the settings page of your app is only applicable when a user visits your website through app center.

To ask for permission from within your site you've to add those permissions in the scope parameter of your Login URL.

fb = new FacebookClient();

    var loginUrl = fb.GetLoginUrl(new
    {

        client_id = "app_id",

        redirect_uri = "http://www.example.com/Facebook.aspx",

        response_type = "code",

        scope = "email,publish_stream" // Add other permissions as needed

    });
Response.Redirect(loginUrl.AbsoluteUri);

Here's good tutorial for using Facebook C# SDK.

For your question in the comments, you can publish your app in the app center by filling all the details on the App Details page and finally submitting it for review.



来源:https://stackoverflow.com/questions/15372659/permissions-for-application

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