JavaScript runtime error: [Messenger] Required property 'target' was not provided occurred

会有一股神秘感。 提交于 2019-12-24 22:30:29

问题


I am using the Developers API with an App I created in LinkedIn.

When I call this method to sign in.....

IN.UI.Authorize().params({ "scope": ["r_liteprofile", "r_emailaddress"] }).place()

a Window begins to open and I get this error message:

Unhandled exception at line 7, column 56783 in http://platform.linkedin.com/in.js 0x800a139e - JavaScript runtime error: [Messenger] Required property 'target' was not provided occurred

I have completed LinkedIn's App Setup, but can't figure what could be causing this. My JavaScript code is below:

[script type="text/javascript" src="//platform.linkedin.com/in.js"]
    api_key: 'xxxxx......xxxxx'
    authorize: true
[/script]

function LinkedInSignIn() {
    IN.UI.Authorize().params({ "scope": ["r_liteprofile", "r_emailaddress"] }).place();
    IN.Event.on(IN, 'auth', getProfileData);
}
function getProfileData() { // Use the API call wrapper to request the member's basic profile data
    IN.API.Profile("me").fields("id,firstName,lastName,email-address,picture-urls::(original),public-profile-url,location:(name)").result(function (me) {
        var profile = me.values[0];
        var id = profile.id;
        alert(profile.firstName);

    });
}


回答1:


As it turned out, the reason this is not working is becuase LinkedIn discontinued it at the end of 2018. Contacting LinkIn's support wasn't much help either. They only said they do no support thier code library and referred my back here to StackOverflow.

For anyone having the same problem, the solutions is to use Oauth2, which is documented at:

https://docs.microsoft.com/en-us/linkedin/shared/authentication/authorization-code-flow?context=linkedin/context

Happy Coding!

Graham



来源:https://stackoverflow.com/questions/56960706/javascript-runtime-error-messenger-required-property-target-was-not-provide

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!