通过 API 删除 Facebook 应用程序

发布于 2024-09-29 05:45:25 字数 165 浏览 2 评论 0原文

我有一个网络应用程序,它将应用程序添加到用户配置文件中,并请求扩展权限。

当用户从我的网络应用程序请求这样做时,我似乎找不到是否有办法使用脚本从用户配置文件中删除应用程序。我知道他们可以在登录 Facebook 时删除该应用程序,但我想知道是否可以通过 API 调用删除该应用程序。感谢您的任何帮助。

I have a web app that adds an application to a users profile, and requests extended permissions.

I can't seem to find if there is a way to use a script to remove the application from the users profile when they request to do so from my web app. I know they can remove the app when logged into Facebook, but I want to know if I can remove the app with an API call. Thanks for any help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

意中人 2024-10-06 05:45:25

您可以使用 HTTP DELETE 请求:

来自 http://developers.facebook。 com/docs/reference/api/user/#permissions

您可以通过使用用户 access_token 向 PROFILE_ID/permissions 发出 HTTP DELETE 请求来代表用户取消对应用程序的授权或撤销特定的扩展权限那个应用程序。

You can use a HTTP DELETE request with:

From http://developers.facebook.com/docs/reference/api/user/#permissions:

You can de-authorize an application or revoke a specific extended permissions on behalf of a user by issuing an HTTP DELETE request to PROFILE_ID/permissions with a user access_token for that app.

不甘平庸 2024-10-06 05:45:25

接受的答案已经超过 3 年了,现在已经过时了。

来自:https://developers.facebook.com/docs/ graph-api/reference/user/permissions/#Deleting

您可以通过调用 Graph API 端点来撤销特定权限:

删除 /{user-id}/permissions/{permission-name}

此请求必须使用用户访问令牌或当前应用程序的应用程序访问令牌进行。如果请求成功,您将收到 true 响应。

请注意,排除 {permission-name} 将撤销所有权限。

The accepted answer is over 3 years old and is now outdated.

From: https://developers.facebook.com/docs/graph-api/reference/user/permissions/#Deleting

You can revoke a specific permission by making a call to a Graph API endpoint:

DELETE /{user-id}/permissions/{permission-name}

This request must be made with a user access token or an app access token for the current app. If the request is successful, you will receive a response of true.

Note that excluding {permission-name} will revoke all permissions.

深海不蓝 2024-10-06 05:45:25

这是从用户配置文件中删除应用程序的javascript方式(Fb js sdk api调用):
https://stackoverflow.com/a/7741978/246435

This is the javascript way (Fb js sdk api call) to remove the application from the user profile:
https://stackoverflow.com/a/7741978/246435

我爱人 2024-10-06 05:45:25

更新:正如其他人提到的,Facebook 现在有了这个 API。不幸的是,我认为没有办法改变已接受的答案来给予信任。

来自: https://developers.facebook.com/docs/ graph-api/reference/user/permissions/#Deleting

您可以通过调用图形 API 来撤销特定权限
端点:

删除/{用户 ID}/权限/{权限名称}

此请求必须使用用户访问令牌或应用程序访问权限发出
当前应用程序的令牌。如果请求成功,您将
收到 true 响应。

请注意,排除 {permission-name} 将撤销所有权限。

UPDATED: As others have mentioned, Facebook now has this API. I don't think there is a way to change the accepted answer to give credit unfortunately.

From: https://developers.facebook.com/docs/graph-api/reference/user/permissions/#Deleting

You can revoke a specific permission by making a call to a Graph API
endpoint:

DELETE /{user-id}/permissions/{permission-name}

This request must be made with a user access token or an app access
token for the current app. If the request is successful, you will
receive a response of true.

Note that excluding {permission-name} will revoke all permissions.

终弃我 2024-10-06 05:45:25

如果有人感兴趣的话,我有一个 PHP 示例(2017 年使用 Graph v5):

# v5 with default access token fallback
$fb = new Facebook\Facebook([/* . . . */]);

$fb->setDefaultAccessToken('{access-token}');

# These will fall back to the default access token
$response = $fb->get('/me');
$response = $fb->post('/me/feed', $data);
$response = $fb->delete('/123', $data);

所以你必须使用:

$response = $fb->delete('/123', $data);

而不是使用 v4 中的 FacebookRequest 类。

I have a PHP example if anyone is interested (with Graph v5 in 2017):

# v5 with default access token fallback
$fb = new Facebook\Facebook([/* . . . */]);

$fb->setDefaultAccessToken('{access-token}');

# These will fall back to the default access token
$response = $fb->get('/me');
$response = $fb->post('/me/feed', $data);
$response = $fb->delete('/123', $data);

So you would have to use:

$response = $fb->delete('/123', $data);

Instead of using the FacebookRequest class in v4.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文