I am using the standard Javascript method of signing in with a user:
<script type="text/javascript" src="linkedInUrl">
api_key: s4mp13
authorize: true
onLoad: onLinkedInLoad
</script>
and I am unable to access a user's email field with the following call:
function onLinkedInAuth() {
IN.API.Profile("me") // get user
.fields(["email-address"])
.result(function (result) {
profile = result.values[0];
$.post('/User/Authorize/', { 'profile': profile }, function (data) {
window.location = data;
});
});
}
I take it this is because I have not specified the member permission 'r_emailaddress'
? But I have looked around and can only see examples of this with the REST API
, how do I define the member permissions in JavaScript
?
Or is there another way to achieve this?
I am using the standard Javascript method of signing in with a user:
<script type="text/javascript" src="linkedInUrl">
api_key: s4mp13
authorize: true
onLoad: onLinkedInLoad
</script>
and I am unable to access a user's email field with the following call:
function onLinkedInAuth() {
IN.API.Profile("me") // get user
.fields(["email-address"])
.result(function (result) {
profile = result.values[0];
$.post('/User/Authorize/', { 'profile': profile }, function (data) {
window.location = data;
});
});
}
I take it this is because I have not specified the member permission 'r_emailaddress'
? But I have looked around and can only see examples of this with the REST API
, how do I define the member permissions in JavaScript
?
Or is there another way to achieve this?
Share Improve this question edited Nov 28, 2012 at 12:36 DevDave asked Nov 28, 2012 at 10:33 DevDaveDevDave 6,92812 gold badges68 silver badges100 bronze badges2 Answers
Reset to default 9I found the solution hidden away in the LinkedIn forums, scope can be defined here:
<script type="text/javascript" src="linkedInUrl">
api_key: s4mp13
authorize: true
onLoad: onLinkedInLoad
scope: r_fullprofile r_emailaddress
</script>
If you want to do this after page load, you can do the following:
IN.ENV.js.scope.push('r_fullprofile');
And then bind the following to a click:
IN.User.authorize();
Note that IN.User.authorize only seems to prompt for new permissions once / page load. Not sure why or if there is a work-around for that.
Also note that this is not fully documented as far as I can tell, and so it may or may not be guaranteed to work going forward...
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745299606a4621355.html
评论列表(0条)