我在啓動facebook應用程序時使用scope
參數要求一些額外的權限。有沒有什麼辦法可以立即知道哪些權限被用戶拒絕?檢測用戶是否拒絕了我的Facebook應用程序中的任何權限
2
A
回答
1
3
這是一個簡單的函數(從我寫的簡化Facebook API調用的類中修改)來檢查Facebook應用的「範圍」和用戶授予的權限之間是否存在差異。
function checkPermissions($scope, $facebook)
{
// Break the scope into an array
$scope = array_map('trim', explode(",", $scope));
// Get the users permissions from Facebook and put them in an array
$getUserPerms = $facebook->api('/me/permissions');
$userPerms = array_keys($getUserPerms['data'][0]);
// Permissions not granted is the difference between these arrys
$ungrantedPerms = array_diff($scope, $userPerms);
if (! empty($ungrantedPerms)) {
// authenticate user again
}
}
是假定範圍以下列方式格式化:
$scope = 'email, user_about_me, user_likes, manage_pages, publish_stream';
相關問題
- 1. Facebook IOS SDK:當用戶拒絕publish_stream權限時檢測到
- 2. 如何檢測用戶拒絕重定向到Facebook TAB應用程序的權限請求對話框
- 3. Python應用程序權限被拒絕
- 4. React Native如何查找用戶是否在應用程序設置中拒絕了權限
- 5. ios應用程序權限被拒絕更新應用程序
- 6. 應用程序被拒絕,健康應用程序權限
- 7. 權限在/ system/priv-app中拒絕應用程序的android.intent.action.REBOOT
- 8. 檢查用戶是否已修改Facebook權限對於應用程序
- 9. 檢查權限facebook應用程序
- 10. 拒絕用戶對reg值的權限?
- 11. errno的13權限被拒絕:「/用戶」
- 12. 用戶已拒絕代碼的權限
- 13. 拒絕默認用戶的Git權限
- 14. PHP-SDK:檢查用戶是否授權我的應用程序
- 15. 如何檢測用戶是否購買了我的應用程序?
- 16. 如何使用Facebook C#SDK檢查用戶是否已授予我的應用程序某些權限集?
- 17. 檢查用戶是否已安裝我的Facebook應用程序
- 18. 檢查Facebook用戶是否喜歡我的應用程序
- 19. Facebook應用程序 - 我是否需要這些權限?
- 20. Facebook:我如何檢測用戶的當前權限?
- 21. android marshmallow:如何知道用戶是否拒絕一個應用程序的權限?
- 22. 檢測用戶是否喜歡Facebook應用程序
- 23. 檢測用戶是否從AppInvite Facebook安裝應用程序
- 24. 禁用UIAlertView按鈕是否會拒絕我的應用程序?
- 25. 我的權限被拒絕使用Kivy
- 26. Facebook的PHP API - 重定向用戶時,他們拒絕權限
- 27. 檢測用戶是否安裝了我的Chrome擴展程序?
- 28. Facebook的拒絕新的權限
- 29. facebook從應用程序檢查用戶權限
- 30. ASP.NET應用程序訪問數據庫的權限被拒絕
+1。我結束了使用類似的東西。 – 2013-03-08 17:31:07
太棒了。我知道這很晚了(真的很晚),但我認爲它會幫助其他人,特別是考慮在Facebook API文檔中找到這種類型的信息有多困難! – 2013-03-08 17:45:13