I am trying to get LinkedIn Access Token after login. Login is working fine with JavaScript SDK and I'm able to receive "oauth_token" and member_id. I need access_token to verify the email address (if it is not forged on the way).
Below is my script:
<script>
function LoginWithLinkedIn() {
IN.User.authorize(afterAuthorization);
}
function afterAuthorization(response){
debugger
if(IN.User.isAuthorized()==true){
getProfileData();
}
}
function onSuccess(data) {
console.log(data);
}
function onError(error) {
console.log(error);
}
function getProfileData(r) {
IN.API.Profile("me")
.fields("id,firstName,lastName,email-address,picture-urls::(original),public-profile-url,location:(name)")
.result(onSuccess)
.error(onError);
}
</script>
I need help getting the access_token after successful authorization. Any help is highly appreciated!
Thanks!