[英]IN.User.Authorize callback never fired
Since today, our application that uses the linkedin javascript SDK to authenticate users stopped working.从今天起,我们使用linkedin javascript SDK 来验证用户身份的应用程序停止工作。 We realized that the call to https://platform.linkedin.com/in.js now redirects to https://platform.linkedin.com/xdoor/scripts/in.js .我们意识到对https://platform.linkedin.com/in.js的调用现在重定向到https://platform.linkedin.com/xdoor/scripts/in.js 。
Consequently, calls to IN.User.Authorize(callbackFunction)
successfully opens the authentication dialog window but the callback is never fired anymore.因此,调用IN.User.Authorize(callbackFunction)
成功打开身份验证对话框窗口,但不再触发回调。
Also, in another part of our application we are using the IN.UI.Authorize.place().onWindowRemove.subscribe(callbackFunction)
to track dialog closes.此外,在我们应用程序的另一部分,我们使用IN.UI.Authorize.place().onWindowRemove.subscribe(callbackFunction)
来跟踪对话框关闭。 This feature has also stopped wording and now opens a new window with the url invalid://
and the console throws this error: 此功能也已停止使用,现在会打开一个带有 url invalid://
的新窗口,并且控制台会抛出此错误:
jSecure Error: URL should be absolute with allowed schemas, relative, a hash fragment or query string. TODO?client_id=XXXX&type=user-agent in.js:7
jSecure Error: URL should be absolute with allowed schemas, relative, a hash fragment or query string. invalid://?xdOrigin=https%3A%2F%2FXXX-XXX&xdChannel=XXXX&xd_origin_host=https%3A%2F%2FXXXX.XXXX in.js:7
jSecure Error: URL should be absolute with allowed schemas, relative, a hash fragment or query string. TODO?client_id=XXXX&type=user-agent
Do you have an idea on why this stopped working ?你知道为什么这停止工作了吗?
EDIT: Bug reappeared as of 2019 01 28.编辑:截至 2019 年 01 月 28 日,错误再次出现。
Try replacing window.IN.User.authorize with window.IN.user.authorize尝试用 window.IN.user.authorize 替换 window.IN.User.authorize
window.IN.user.authorize is returning a promise and success callback is executed post login success. window.IN.user.authorize正在返回一个 promise,并且在登录成功后执行成功回调。 Its weird but working if we replace User with user如果我们用用户替换用户,它很奇怪但有效
window.IN.user.authorize().then(function(data){
console.log("Logged in successfully .");
window.IN.API.Raw("/people/~:(id,first-name,last-name,formatted-name,headline,location,industry,current-share,num-connections,num-connections-capped,summary,specialties,positions,picture-url,site-standard-profile-request,api-standard-profile-request,public-profile-url,email-address)").method("GET").body().result(function (oData) {
that.props.dispatch(userCreation(linkedInProfileFormat(oData)));
});
},function(error){
alert("Linkedin failed because of harshita !");
});
Try this code.试试这个代码。 I did some changes and working fine for me.我做了一些改变并且对我来说工作正常。 need to replace window.IN.User.authorize() TO window.IN.user.authorize()需要将 window.IN.User.authorize() 替换为 window.IN.user.authorize()
<script type="text/javascript" src="//platform.linkedin.com/in.js">
api_key: XXXXXXXXX
authorize: true
</script>
<script type="text/javascript">
function liAuth(){
window.IN.user.authorize().then(function(){
getProfileData();
});
}
function setLoginBadge(profile) {
if (!profile) {
profHTML = "<p>You are not logged in</p>";
}
document.getElementById("given_name").value = profile.firstName;
document.getElementById("family_name").value = profile.lastName;
document.getElementById("email").value = profile.emailAddress;
document.getElementById("verifyOauthRequestLinkedIn").submit();
}
function onError(error) {
console.log(error);
}
function getProfileData() {
IN.API.Profile("me")
.fields(["id", "firstName", "lastName", "pictureUrl", "publicProfileUrl","email-address","headline"])
.result(function(result) {
setLoginBadge(result.values[0]);
})
.error(onError);
}
</script>
<a href="#"><img onclick="liAuth()" src="/images/linkedIn.png"></a>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.