LinkedIn set member permission using Javascript API? - Stack Overflow

I am using the standard Javascript method of signing in with a user:<script type="textjavascri

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 badges
Add a ment  | 

2 Answers 2

Reset to default 9

I 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

相关推荐

  • LinkedIn set member permission using Javascript API? - Stack Overflow

    I am using the standard Javascript method of signing in with a user:<script type="textjavascri

    3小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信