How to deauthorize User Facebook Permissions using Koala gem

為{幸葍}努か 提交于 2019-12-12 19:23:20

问题


I am using Koala to handle FB calls. Everything is working fine except I can't figure out how to deauthorize a user's FB permissions.

The equivalente REST call would be to:

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

The Koala wiki indicates all REST calls are supported via:

@rest = Koala::Facebook::API.new(oauth_access_token)

@rest.fql_query(my_fql_query) # convenience method
@rest.fql_multiquery(fql_query_hash) # convenience method
@rest.rest_call("stream.publish", arguments_hash) # generic version

but this doesn't tell me much.

I would prefer to use Koala as I have app secret security enabled and generating app_secret_proof for plain FB REST calls is a major hassle. Koala handles it transparently.


回答1:


Figured it out. After instantiating the @rest object:

@rest = Koala::Facebook::API.new(oauth_access_token, app_secret)

you can check out its methods via:

@rest.methods

and you'll notice it returns RESTful methods like #get_object, #put object, and our winner: #delete_object. Then it's just a matter of doing:

@rest.delete_object("me/permissions")

success!



来源:https://stackoverflow.com/questions/37640242/how-to-deauthorize-user-facebook-permissions-using-koala-gem

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