Linkedin access token doesn't work on v2 api - linkedin

I followed the instructions directly from Linkedin's V2 API Documentation to get an access token and then try to get basic user information through the endpoint https://api.linkedin.com/v2/me , but it simply returns the following error:
{
"serviceErrorCode": 100,
"message": "Not enough permissions to access /me GET ",
"status": 403
}
I try to use the same code to the version 1 of the API equivalent (https://api.linkedin.com/v1/people/~?format=json) and it works.
Both the v1 and v2 documentation redirects to the same url (https://developer.linkedin.com/docs/oauth2), that makes sense because both authenticates via OAuth 2.0.
I review the permissions of my app and they looks good (I tried with r_basicprofile, * r_emailaddress*, both of them, and also with all the permissions availables both explicit when I request the access the authorization code and in the application settings in Linkedin Dashboard).
I would like to know if there is something that I'm missing or that I'm doing wrong in the process to make this work.

LinkedIn API is private. You have to request authorization from them at https://business.linkedin.com/marketing-solutions/marketing-partners/become-a-partner/marketing-developer-program (or one of their other programs).

If you authenticate with v2 using r_basicprofile(following this https://learn.microsoft.com/en-us/linkedin/shared/authentication/authorization-code-flow?context=linkedin/consumer/context) you are not allowed to query against https://api.linkedin.com/v2/me but can query on https://api.linkedin.com/v1/people/~.
To query against https://api.linkedin.com/v2/me you must authenticate using r_liteprofile.

Related

HTTP Connector in Microsoft Power Automate - Login against Azure AD app registration on behalf of user not working

I hope you are doing fine :)
I have the following problem/problems.
I have created a dummy (robot) user. In Azure AD there is an App Registration with some Power BI delegated permission services.
I want to automate the deletion of a push dataset via a HTTP request.
For this, I need to authenticate against that App Registration from Azure AD. With postman, everything worked perfectly, I got the token as a response.
Then, I tried to make the same request using the HTTP connector in PowerAutomate.
I get the following error
{"error":"invalid_request","error_description":"AADSTS900144: The request body must contain the following parameter: 'grant_type'.\r\nTrace ID: e6d68953-ce1c-4217-856c-ae3aada82e00\r\nCorrelation ID: f50db4d9-d5bb-4396-af11-214717721f43\r\nTimestamp: 2022-10-26 19:12:48Z","error_codes":[900144],"timestamp":"2022-10-26 19:12:48Z","trace_id":"e6d68953-ce1c-4217-856c-ae3aada82e00","correlation_id":"f50db4d9-d5bb-4396-af11-214717721f43","error_uri":"https://login.microsoftonline.com/error?code=900144"}
The connector looks like this->
I have tried other ways as well.
The following error ->
{"error":"invalid_grant","error_description":"AADSTS50126: Error validating credentials due to invalid username or password.\r\nTrace ID: fec65949-0701-4727-af3b-2c2b8eb73a00\r\nCorrelation ID: 42c6c04b-98be-477d-8d36-52a01a473a40\r\nTimestamp: 2022-10-26 19:23:50Z","error_codes":[50126],"timestamp":"2022-10-26 19:23:50Z","trace_id":"fec65949-0701-4727-af3b-2c2b8eb73a00","correlation_id":"42c6c04b-98be-477d-8d36-52a01a473a40","error_uri":"https://login.microsoftonline.com/error?code=50126"}
I get from the the next HTTP connector inputs. I tried creating a query out of the previous json. It says the username or password are invalid but I logged in successfully for a number of times with those exact credentials. That I am sure of.
The dummy inputs in the picture are used to avoid the real ids, username and password.
This worked for me ...
Add a header setting Content-Type to application/x-www-form-urlencoded and add the URL form encoded content string like thus ...
client_id=<CLIENT_ID>c&grant_type=password&username=<USERNAME>&password=<PASSWORD>&scope=User.read
If you're using the password grant type approach, you shouldn't need a client secret, just the client ID.

LinkedIn Access Token Being Used

I've successfully secured my access token for the LinkedIn API. However, when I try to use it to gather user information (currently just my own so I know that the profile has all public settings) using this code:
requestURL = 'https://api.linkedin.com/v2/people/(id:{my_linkedin_id})'
headers = {'Authorization': 'Bearer' + ' ' + access_token}
a = requests.get(requestURL,headers=headers)
could someone elaborate on any steps I might be messing?
When I run this code I keep getting a
<Response [404]>
You have 404 as response and in LinkedIn documentation you can see that:
404 Resource Not Found
This error occurs when your application tries to call an API or fetch
an entity that does not exist. For example, the API to get a friend’s
profile is /v2/people/id={personId}, not /v2/person/id={personId}. In
some cases (Ads, for example), a 404 error is returned when attempting
to access a restricted API. See 403 Access Denied and contact your
partner technical support channel if you continue to see the error.
I think you need too check if your link to resource is good.

Migration to Version 2.0 of LinkedIn API

Recently I created an application for the LinkedIn API (Status is Development).
I managed to do requests to the old v1 version of the API, for example 'https://api.linkedin.com/v1/people/~' and '/v1/people/~/shares'. But when I try to use the new version, v2, of the API I encounter some problems.
Problem 1: When I try to request 'https://api.linkedin.com/v2/me' I get the following error:
{
"serviceErrorCode": 100,
"message": "Not enough permissions to access: GET /me",
"status": 403
}
From what I understand to fix this problem I should use the 'r_liteprofile' scope when requesting a access token. But this leads to my next problem.
Problem 2: When I request the oauth endpoint (https://www.linkedin.com/oauth/v2/authorization?response_type=code&client_id={id}&redirect_uri={redirect_uri}&state={state}&scope=r_liteprofile) I get the following error:
error=unauthorized_scope_error&error_description=Scope "r_liteprofile" is not authorized for your application
So I figured I need to select these scopes in the Application settings. But that leads to my third and final problem.
Problem 3: I am unable to select the required application permissions at 'https://www.linkedin.com/developer' for my application.
My Default Application Permissions
How do I manage to use the new (v2) API version?
Thanks!
For moving first you check :
you have to check Linkedin - Myapp - Default Application Permissions
You have r_liteprofile permission or not ( for calling this 'https://api.linkedin.com/v2/me)
in V2 you can use : r_liteprofile for firstName,lastName,profilePicture,id r_emailaddress for getting emailAddress
Check this : https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/migration-faq?context=linkedin/consumer/context

How to make LinkedIn V2 Share (SocialActions) work correctly?

We recently obtained the r_ad_campaigns permission to work with the LinkedIn V2 API:
https://developer.linkedin.com/docs/lms/marketing-analytics/quick-start#
https://developer.linkedin.com/docs/guide/v2/shares/network-update-social-actions
To work correctly, I have obtained a new TOKEN with the new permission: r_ad_campaigns
I have made the following 3 calls with this new token:
https://api.linkedin.com/v2/socialActions/{share URN}?oauth2_access_token=TOKEN
https://api.linkedin.com/v2/socialActions/{share URN}/comments?oauth2_access_token=TOKEN
https://api.linkedin.com/v2/socialActions/{share URN}/likes?oauth2_access_token=TOKEN
And they all return the same result:
{"serviceErrorCode": 100, "message": "Not enough permissions to access: GET / socialActions / {share URN}", "status": 403}
The same thing happens with these post:
Why does LinkedIn v2 Share API give not enough permissions error on any v2/shares endpoint?
LinkedIn V2 API permission for reading socialActions and Shares
Please, does anyone know how to solve this problem and that it works correctly? Is it important.
It's working in my case, this problem related to permission
Follow these steps,
Open Url, https://www.linkedin.com/developers/apps/
Goto products
Select all products
Marketing Developer Platform Product need some days to be approved
If all products are successfully installed
Check OAuth 2.0 scopes permissions to access data using your app

Got These credentials do not authorize access from nokia here api getlinkinfo

I'm performing the following call:
http://route.st.nlp.nokia.com/routing/7.2/getlinkinfo.json?app_id=APP_ID&waypoint=LATITUDE%2CLONGITUDE&app_code=APP_CODE
it always worked until yesterday, when I started getting http 403 error with the following json error message:
{
"response":{
"_type":"ns2:RoutingServiceErrorType",
"type":"SystemError",
"subtype":"SystemError",
"details":"These credentials do not authorize access. Please contact your customer representative or submit a request here https://developer.here.com/contact-us to upgrade your account. You can also get valid credentials by registering for a free trial license on https://developer.here.com.",
"metaInfo":{
"timestamp":"2017-11-08T10:48:02Z",
"mapVersion":"8.30.76.154",
"moduleVersion":"7.2.201744-2851",
"interfaceVersion":"2.6.34"
}
}
}
I checked my account but it's a Public Basic Plan one so there is no expiration or restriction on the api I'm calling.
Domains with nokia.com aren't supported anymore. You need to change the domain name to the actual one.
Try to use https://route.api.here.com/

Resources