LinkedIn V2 api: Not enough permissions to access /me GET - linkedin-api

I have been trying to use the linkedin V2 api, but constantly getting error.
I created an developer application. Set up redirect url as "https://www.getpostman.com/oauth2/callback" to make request using postman (as per postman documentation).
Filled up form to request access token.
But everytime I use the token and make a query, I get an error:
But I have selected all the default application permissions in my application. Am I missing something?

The LinkedIn API has been largely closed off and is only available to approved LinkedIn developers. You can request authorisation here: https://business.linkedin.com/marketing-solutions/marketing-partners/become-a-partner/marketing-developer-program

This is a old question, but the solution is to use the scope r_liteProfile instead of r_basicprofile during the first step of authorization.
https://www.linkedin.com/oauth/v2/authorization?response_type=code&client_id=*****&redirect_uri=http://yourauthorizationserver&state=RandomString&scope=r_liteprofile
Then, use the value of the code parameter passed back from LinkedIn to http://yourauthorizationserver in the second step of authorization:
curl -X POST \
'https://www.linkedin.com/oauth/v2/accessToken?code=codeobtainedwiththefirstcall&grant_type=authorization_code&client_secret=*****&client_id=***&redirect_uri=yourredirecturi' \
Solution found here:
Any queries to the api.linkedin.com/v2/ return "Not enough permissions to access ..."

have you checked and allowed access to "r_basicprofile" permissions? go to your app and check your Default Application Permissions for people/~/me endpoint.

If you are using https://oauth.io/ you have to add scopes in the Keys and Permission Scope configuration page:

Related

access token LinkedIn API

For a school project I need access to LinkedIn API.
I have already created an app on LinkedIn Developers. However, when I do a GET request to https://www.linkedin.com/oauth/v2/authorization, I am not able to get an access token, and I get "you need to pass the scope"
Even though the documentation specified that the scope field is optional, I added scope=scope=r_liteprofile%20r_emailaddress%20w_member_social at the end of my request and got a "invalid scope error".
As for the redirect uri field, I am not sure what to put (can I put a random website URL?)
If someone knows the solution to that problem or know other ways to get an access token, I would be very grateful :) Thank you !
Kim
You need to provide a redirect URI in order to get a valid access token.
First step:
https://www.linkedin.com/oauth/v2/authorization?response_type=code&client_id=YOURCLIENTID&redirect_uri=https://my.webserver.com
Once you login and confirm LinkedIn will redirect you to the provided redirect URI with the code parameter. The next step is to exchange this code for an access token.
Second step:
https://www.linkedin.com/oauth/v2/accessToken?grant_type=authorization_code&code=CODE&redirect_uri=https://my.webserver.com&client_id=YOURCLIENTID&client_secret=YOURCLIENTSECRET
If everything is valid LinkedIn will again redirect to the provided redirect URI, but this time with the access token.
Hope it helps.

LinkedIn Ads Rest API - I can connect to /v1/people/~ but not the /v2/adAnalyticsV2?

I can connect to the /v1/people/~ API URL perfectly with my Access Token but trying the same Token on the /v2/adAnalyticsV2? gives me a 403 error (without further explanation). I read through all the LinkedIn documentation about their Rest API and I just don't get it.
Please help.
Based on the error code, it looks like you do not have the proper permission to access this endpoint.
Has your application been given access to use LinkedIn's Marketing Analytics API? If not, you can apply for access here: https://business.linkedin.com/marketing-solutions/marketing-partners/become-a-partner
If you already have access, you should check if your application is requesting the required permission when requesting authorization codes. You would do this either by selecting it in the Default Application Permissions section when setting up your application, or by explicitly requesting it through the scope parameter in the authorization step
I got a note from the engineering team that I can't locate now mentioning something about disabling analytics from v2 of the API for some reason. Worth reaching out to your contact at LI, for sure, but most likely it was removed recently.

How do you generate a access token to retrieve Facebook Ads report stats?

I am trying to retrieve the ads report stats, outlined here:
https://developers.facebook.com/docs/reference/ads-api/adreportstats/
But I am currently stuck with generating an access token. I was going through here: https://developers.facebook.com/docs/reference/ads-api/overview/ ,
And it looks like the only way to generate an access token is to generate it by using live web app.
Is there any other way to generate an access token?
Yes, the only way to get a User access token is to have a user authorise your app via the documented login methods: full documentation here: https://developers.facebook.com/docs/facebook-login/overview/
No.
At least not as far as I can tell. It appears that you need 3 things to generate the token:
App Id, App Secret, Url
https://developers.facebook.com/docs/reference/ads-api/overview/
in the Provide Authorization section.
I'm having a similar issue.
You don't want a client token, you need to generate an access token for the ads reporting.
I've found the Facebook API somewhat confusing because they seem to blur the lines of Access Tokens for accessing user information, and Access Tokens for accessing reporting information.

Facebook Connect Graph API - Why Can't I Retrieve All User's Details?

I feel like every second question i ask here is relating to Facebook Connect - that says a lot about their API. Anyway, that's politics, i digress..
I'm trying to pull back user details from the Graph API for use in my application (which is an FBML external website - JavaScript SDK for authentication).
I have requested the following permissions from the user: (using the regular dialog)
publish_stream
email
This works, and allows me to post to the user's wall, and grab their email from the Graph API.
But when i do a HTTP GET Request to the following URL:
https://graph.facebook.com/uid?access_token=oat (where uid = the user id of the user i'm attempting to grab details for, and oat = the OAuth token i have).
All that comes back in the JSON is the User ID (which i already have, since im putting it in the URL), and the email.
Why can i not get things like first name, last name, locale, etc?
Am i using the wrong URL? Is my OAuth token wrong?
I'm getting the OAuth token from here:
https://graph.facebook.com/oauth/access_token?type=client_cred&client_id=myappid&client_secret=myappsecret
UPDATE:
It looks like the issue is my OAuth token.
Because when i go to the docs: http://developers.facebook.com/docs/api
And use the sample OAuth Token for the user im trying to retrieve, it gets all the details.
Anyone know what is wrong with my OAuth token call?
So, i was using the wrong URL for the OAuth Exchange. It needed to be this:
https://graph.facebook.com/oauth/exchange_sessions?type=client_cred&client_id=myappid&client_secrete=myappsecret&sessions=userseshid
The URL that i WAS using was as per the doco, the above one that works is nowhere to be found.
I'm at the point with FBC that i no longer care about the how, if it works, be thankful that it does even that and move on.
EDIT:
Also, i was wondering why the Graph API calls would "stop" working for no reason.
The answer is i needed to compare the Session Key used to obtain the OAuth token, with the Session Key currently in the cookies. If they are different, i needed to get a new OAuth token.
The session key used for any OAuth token is part of the actual OAuth token:
aaa|bbbb|cccc
Where bbbb is the session key. So i just compare that before doing any Graph API calls.

Facebook REST Api with OAuth tokens

As described in the Facebook Auth guide, I'm able to make (most) old REST API calls with OAuth tokens
i.e.
http://api.facebook.com/restserver.php?
method=friends.get&
app_id=...&
v=1.0&
call_id=...&
sig=...
becomes
https://api.facebook.com/restserver.php?
method=friends.get&
token=...
This does NOT work with the method "admin.setAppProperties". I get an "Application does not have permission for this action" error. The OAuth token I have though, has granted every available permission including offline access to my app, however. Any clue whats going on? Facebook docs and forums are characteristically mum.
In case you haven't managed to fix it yet, I've found the problem with their documentation:
the parameter name for the access token is wrong: it is "access_token" and not "token"
https://api.facebook.com/restserver.php?
method=friends.get&
access_token=...