How to revoke user permission on Socialite - facebook-graph-api

I want to revoke the permission user gave me on Facebook, if he denied to give me Facebook's email. How can I do that?. I'm using Socialite on Laravel 5.2
Thank you

DELETE /{user-id}/permissions/{permission-name}
DELETE /{user-id}/permissions
This is explained in the official docs: https://developers.facebook.com/docs/facebook-login/permissions/requesting-and-revoking#revoking
You can revoke permissions and even the general authorization.

I have the same problem as you.
Reading the Facebook Graph API documentation, I found the same orientacions as luschn, but it did not solve my problem.
How I solved it
use GuzzleHttp \ Client;
$ http = new Client ();
$ req = $ http-> delete ("https://graph.facebook.com/v3.0/{USER ID} / permissions? access_token = {API TOKEN}");
I found the token API on the token generator: https://developers.facebook.com/tools/explorer/
So I made the direct request, I believe it is not the best form but solved it.
I hope this can help you and other person.

Related

Google API create new User

I'm using Zapier and try to create a new User in Google.
The documentation is pretty unclear.
This is the request I'm making:
Now I understand, that I need to add authorization to the request.
How do I authorize the request? I created an API Token in the Google Cloud but this doesn't work as a GET parameter.
Is the Request right? Do I have to change something?
Thank you for your help.
Posting DalmTo's comment for visibility.
This appears to be using the Directory Admin API for Workspace accounts. You can consult the Admin SDK: Directory API docs for this.
As it's creating Google Workspace users, you may want to try using a service account authorization.
For an example of an API request, selecting the necessary endpoint and method, e.g. asps.get, and use the API Explorer to test your requests.

Linkedin V2 API (POSTMAN)

I want to create application Which will share post in company page.
I have Permissions in linkedin :
Using documentation im trying to get Token. but i have error :
{
"error": "access_denied",
"error_description": "This application is not allowed to create application tokens"
}
https://learn.microsoft.com/en-us/linkedin/shared/authentication/client-credentials-flow?context=linkedin/context
*** Real credentials was Replaced by xxxxx
Use this Postman Collection for the LinkedIn Oauth 2.0 API. And follow these steps in this article
All the permissions you have are 3-legged permission and you are trying to get token using 2-legged process.
Please follow below workflow to create access/bearer token using 3-legged flow:
https://learn.microsoft.com/en-us/linkedin/shared/authentication/authorization-code-flow?context=linkedin/context
If your application needs access to information from a member's LinkedIn profile, use the Authorization Code Flow to request permission from the member.
PS: Company page post also requires Authorization Code Flow.
You can use Postman Collections here to view some examples and use cases.
An update documentation for Postman Oauth 3 is here
Follow these steps in this article
https://www.linkedin.com/oauth/v2/authorization?
client_id=yyyyy
&redirect_uri=xxxx
&scope=r_liteprofile%20r_emailaddress%20w_member_social
&response_type=zzzzz

force google to refresh token via python social auth

We're working on a project that depends on PSA (0.2.1) for authentications with google oauth2 (offline). Somehow we lost some refresh tokens of some users, we want to force those users to RE-AUTHENTICATE so we can get new refresh token from google
we tried both :
Diconnect those users using /diconnect/google-oauth2, we got a NotAllowedToDisconnect exception, even after removing social.pipeline.disconnect.allowed_to_disconnect from SOCIAL_AUTH_DISCONNECT_PIPELINE, we got no exception, but when the user re-authenticate, there is no refreh_token in google response
add approval_prompt=force to 'account:social:begin' url, but it doesn't return the refresh_token
Any idea will be highly appreciated.
Update: We tried to use {% url 'account:social:begin' 'google-oauth2' %}?approval_prompt=force&next=/ to force the approval_prompt for certain users (with missing tokens), but its seem to have no effect over google oauth.
Thanks
Using this setting does the trick:
SOCIAL_AUTH_GOOGLE_OAUTH2_AUTH_EXTRA_ARGUMENTS = {
'access_type': 'offline',
'approval_prompt': 'force'
}
Use case example at http://psa.matiasaguirre.net/docs/use_cases.html#re-prompt-google-oauth2-users-to-refresh-the-refresh-token

Get all Facebook posts of user wall

I'm using the Facebook php sdk to try to get posts of a users wall.
When I use the following code I only get some reaction on events and some mentions, but but not the messages, photos's etc. I actually posted on my wall?
What can be the problem?
$result = $facebook->api('/me/feed/',array('access_token' => $facebook->access_token,'limit'=>100));
How are you authenticating and what permissions are you asking for in your access_token? If you aren't authenticating your user, you'll be limited to public posts only. You also need to make sure you request read_stream permission when you authenticate your user.

How to publish to a feed if you have offline_access permission

I am trying to publish to a user's FB account, and I have the following permissions:
* offline_access
* publish_stream
But when I try to post to the user's account, it appears that FB is asking me for an access token (which I don't have).
Does anyone know the structure of the URL to publish to a FB user's stream when you don't have an access token?
Thanks
Do an HTTP POST to /userID/feed?access_token=appID|appSecret
You need to have your app login. About 2/3rds of the way down on the authentication documentation, there are instructions on how to get a session access token for your app.
https://developers.facebook.com/docs/authentication/
Basically, just hit this url:
https://graph.facebook.com/oauth/access_token?
client_id=YOUR_APP_ID&client_secret=YOUR_APP_SECRET&
grant_type=client_credentials
And you will get back an access token you can use to post to any user's wall that your app has permission for.