get facebook extended permission for uploading pho

2019-02-28 10:31发布

问题:

In my facebook application, when the users first starts using it,the app request very basic permission. At a later stage, I need to request extended permission to allow the app to upload photos, I'm googling when falling only on the legacy part:

 FB.Connect.showPermissionDialog("photo_upload",permissionHandler);

Does someone has any idea how to get permission for uploading photos using the new sdk??

回答1:

There is no photo_upload permission. But, you can upload photos using the publish_stream permission instead. And you can see the user's photos using the user_photos permission.



回答2:

To obtain extended permission from the user, there are two ways to ask the permission from the user. In either way, the finality is to get the permission from the user:

  1. Opens a popup and ask the user the extended permission

FB.login(function(response) { if (response.authResponse) { // user is logged in and granted some permissions. } else { // User cancelled login or did not fully authorize. } }, {scope:'read_stream,publish_stream,offline_access'});

  1. Open a new window and ask the user the permission

    window.location="https://www.facebook.com/dialog/permissions.request?app_id=&next=https://apps.facebook.com//&type=user_agent&perms=user_photos,publish_stream,friends_photos&fbconnect=1";

You also need to know which permission you want from the user. Here is a list of permission that you can ask from a facebook user