I 'm using successfully oAuth v2 with the linked in api.
it gives me an access token like that :
access_token: "AQUqvUuTXuQ2_Tr9NutHYlQQEDhiTtkHb5Jn5ozgvDfhXzu4l-TP9pE07VqYiH4QTjijzwWFa28tdmjflrtNG3ycyxNAdVx0WsWl9LcfZMSyYqSfBQjtaWtkF4WzoDoxomS7J0b0m-1avrWbsvU3ZpPc388ACtN3d2wCKgK6CXFXoHNMiz4tnHnKhtjU-yzvnFJDRTSHKKBu4lt1zZZ0hr33w-SsXqh4hAZNHxUu6s2itR85RV1cT17_EfHt2UiqeS7wB7_udxxIEYxSOk5GvdXRT5txDveKLjMs1rMhxHf72JcAoGAoxDSQXK2ek2KcFgYOcJ6Zg5L5pDImfjls4mSGWFnU-w"
del: function mkHttp()
expires_in: 5183999
get: function mkHttp()
me: function mkHttpMe()
patch: function mkHttp()
post: function mkHttp()
provider: "linkedin2"
put: function mkHttp()
toJson: function toJson()
<prototype>: Object { … }
But, unfortunatly, i can't succeed to do a simple get query, after i get authenticated .
This is my first jquery try :
$(function(){
$('#linkedin-button').on('click', function() {
// Initialize with your OAuth.io app public key
OAuth.initialize('MYKEYISOK');
// Use popup for oauth
OAuth.popup('linkedin2').done(function(result) {
$.get( "https://api.linkedin.com/v2/me", function( data ){
console.log(data),
});
})
})
});
This is the $.get firefox console error :
{"serviceErrorCode":65604,"message":"Empty oauth2 access token","status":401}
This is my second try without jquery :
result.get( "http://api.linkedin.com/v1/companies/1441/updates", function( data ) {
console.log(data);
});
it doesnt work either .
This is my 3rd try out :
$.ajax({
url: 'https://api.linkedin.com/v2/me',
headers: {
'access_token':result.access_token
},
method: 'GET',
dataType: 'json',
success: function(data){
console.log('succes: '+data);
}
});
This is my 4th try out , it seems to work now :
$.ajax({
url: 'https://api.linkedin.com/v2/me?oauth2_access_token='+result.access_token,
method: 'GET',
dataType: 'json',
success: function(data){
console.log('succes: '+data);
}
});
but ive got a new error :
{"serviceErrorCode":100,"message":"Not enough permissions to access: GET /me","status":403}
This is the explanation : Any queries to the api.linkedin.com/v2/ return "Not enough permissions to access ..."
Use r_liteProfile instead of r_basicprofile during the first step of Authorization. Use this accessToken solved all of my issues, superb !
do i send well the OAuthv2 settings along with the GET queries, to make it work ?
there is a few information there : https://learn.microsoft.com/en-us/linkedin/shared/authentication/authorization-code-flow?context=linkedin/context#step-4-make-authenticated-requests