Unable to get r_emailaddress from https://api.linkedin.com/v2/me - linkedin

I have used,
<OAuthConfig oAuthScope="r_liteprofile r_emailaddress" providerId="LINKED_IN" userProfileUrl="https://api.linkedin.com/v2/me"/>
and using OAuth2 for this but I'm unable retrieve email with this. Is there possibility to get both email & liteprofile from single accesstoken request?
My app is having permissions with
r_liteprofile
r_emailaddress
w_member_social
Can anyone help me with this?
Thanks in advance.
THIS IS THE RESPONSE I'm getting,
THIS IS JSON OBJECT:
{"lastName":{"localized":{"en_US":"global"},"preferredLocale":{"country":"US","language":"en"}},"firstName":{"localized":{"en_US":"Gifting"},"preferredLocale":{"country":"US","language":"en"}},"id":"_Ru_P5gptv"}
net.sf.json.JSONException: JSONObject["emailAddress"] not found.

The email address is available via the /emailAddress API, not the /me API.
You will need to make an additional GET request to https://api.linkedin.com/v2/emailAddress?q=members&projection=(elements*(handle~))

Related

How To Refresh Microsoft Graph Access Token

I'm using firebase and I'm trying to create a backend function that can fetch an access token using a refresh token.
I've been following along with the Microsoft Graph Documentation for refreshing an access token but I can not get it to work.
I don't understand what I could be doing wrong or even how to go about debugging this. Could it have anything to do with the redirect uri that is set in azure console?
As,i can see you are got "invalid_grant" error , please try a new request to the /authorize endpoint and verify that the code_verifier parameter was correct.
Please
Reference doc- https://learn.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-auth-code-flow#error-codes-for-token-endpoint-errors

access_token for Google Analytics API

I want to get a access_token to get information from Google Analytics API by passing it in the browser . I am not able to find the correct documentation anywhere. I have tried multiple ways but nothing seems to work. As of now, I got tokens via Google Analytics Query Explorer and it works for 60 minutes. I am looking for a permanent token or a token which is valid for a more period of time.
In order to access private Google analytics data you need to be authorized. In order to be authorized you use something called Oauth2
The initial request will look something like this. It will allow the user to consent to your applications access to their data
GET https://accounts.google.com/o/oauth2/auth?client_id={clientid}.apps.googleusercontent.com&redirect_uri=urn:ietf:wg:oauth:2.0:oob&scope=https://www.googleapis.com/auth/analytics.readonly&response_type=code
Once the user has consented to your accessing their data, you will be given an authorization code.
Once you have the authorization code you can exchange it for an access token. This is a http post request.
POST https://accounts.google.com/o/oauth2/token
code=4/X9lG6uWd8-MMJPElWggHZRzyFKtp.QubAT_P-GEwePvB8fYmgkJzntDnaiAI&client_id={ClientId}.apps.googleusercontent.com&client_secret={ClientSecret}&redirect_uri=urn:ietf:wg:oauth:2.0:oob&grant_type=authorization_code
The response should then look something like this.
{
"access_token" : "ya29.1.AADtN_VSBMC2Ga2lhxsTKjVQ_ROco8VbD6h01aj4PcKHLm6qvHbNtn-_BIzXMw",
"token_type" : "Bearer",
"expires_in" : 3600,
"refresh_token" : "1/J-3zPA8XR1o_cXebV9sDKn_f5MTqaFhKFxH-3PUPiJ4"
}
The access token will work for one hour.
I recommend looking for a sample and a client library in your chosen programming language so that you dont have to do all this manually most of the libraries are designed to handle authentication and authorization for you.

Sabre getting started V3 AuthToken V3

I am trying to access https://api-crt.cert.havail.sabre.com/v3/auth/token from the postman with valid base64 encoded Authorization header.
What is the valid value for username? Isn't it same which I used for registration. Document showing it as EPR in form 'user-group-domain'. Please help
I am getting an error.
{
"error": "invalid_client",
"error_description": "Credentials are missing or the syntax is not correct"
}
Go to: https://developer.sabre.com/user/{YOUR_USER}/applications
There you'll see YOUR_USER's application
Your user is what you have below Client ID and the password is below Client Secret. On that you have: Base64(Base64(Client ID):Base64(Client Secret)) (this is generic, to show how it should be coded.
This will only work on CERT environment.
It may be obvious what I am going to talk about, but you must have a SABER GDS authorized user to use this service.
If you do not have an authorized web user you will not be able to make the service work.
Ask Sabre or the agency that you represent this user to access, because without this credential correctly released you will not be able to make any REST / SOAP services work.
You can download the postman functionality package from the link below:
https://github.com/SabreDevStudio/postman-collections
https://developer.sabre.com/product-catalog?f%5B0%5D=product_type%3Aapi_reference

Using Linkedin Access Token

I've successfully gotten my access token to the LinkedIn api! However, I can only seem to make this request call:
GET https://api.linkedin.com/v2/me/
When I try to look up another public member's information using:
GET https://api.linkedin.com/v2/people/(id:{person ID})
I get the 403 error saying: serviceErrorCode":100,"message":"Not enough permissions to access: GET- vanityName /people","status":403.
This happens when I try to look up the member using the vanity name as well. Can someone explain why this is happening even though I've gotten the access token?
It's what the error message says: LinkedIn hasn't given your application permission to fetch other people's profiles. You can only fetch your own. Those APIs exist, but aren't given to everyone.

How can I verify a LinkedIn access token?

How can I verify a LinkedIn access token?
I need to check if an access token is valid or not?
ex: in Facebook
https://graph.facebook.com/me?access_token=access_token
Is there a similar way to do it in LinkedIn?
I found that it can be done like this:
https://api.linkedin.com/v1/people/~?oauth2_access_token=YOUR-ACCESS-TOKEN
and that's it :).
Additionally, you can filter the values:
https://api.linkedin.com/v1/people/~:(id,first-name,last-name,headline,picture-url,location,industry,current-share,num-connections,summary,specialties,positions)?format=json&oauth2_access_token={0}
You can use Token Introspection to get some informations about the token
https://learn.microsoft.com/en-us/linkedin/shared/authentication/token-introspection?context=linkedin/context
The url has been changed and the v1 API does not work anymore. Do use this one, if you need to verify access tokens generated from Linkedin.
https://api.linkedin.com/v2/me?oauth2_access_token=<your-token-here>
For other social media's, use can use urls from this gist: https://gist.github.com/pavittarx/15b46b08e779c2113864e9db399f35ac

Resources