我正在嘗試通過LTI連接集成 LinkedIn Learning Single-Sign-On ,但是我總是面臨回應:LTI_FAILED_AUTHENTICATION。
LinkedIn 學習 - LTI_FAILED_AUTHENTICATION
當我在Saltire測驗平臺上測驗它時,它奇怪地作業。
引數與我從下面的代碼發送的內容相匹配: Saltire LTI Success authentication
已嘗試將oauth_nonce,timestamp和的值oauth_signature從 Saltire復制到我的頁面,這也有效,這排除了域白名單要求的可能性。
LinkedIn 支持人員回來說生成的簽名似乎有問題,但我不確定它有什么問題,因為這是由傳遞的引數生成的。
我的頁面中是否有一些我沒有看到的錯誤設定?
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="robots" content="noindex" />
<title>Access LinkedIn Learning</title>
<script src="bundle.js"></script>
</head>
<body>
<form id="id_frmConnect" name="frmConnect" enctype="application/x-www-form-urlencoded">
</form>
<script>
var oauth = require('oauth-sign');
var action = 'https://www.linkedin.com/checkpoint/enterprise/login/[accountID]?application=learning&redirect=https://www.linkedin.com/learning/me';
var method = 'POST';
var consumer_key = '************';
var consumer_secret = '************';
var timestamp = Math.round(Date.now() / 1000);
var params = {
lti_message_type: 'basic-lti-launch-request',
lti_version: 'LTI-1p0',
oauth_callback: 'about:blank',
oauth_consumer_key: consumer_key,
oauth_nonce: btoa(timestamp),
oauth_signature_method: 'HMAC-SHA1',
oauth_timestamp: timestamp,
oauth_version: '1.0',
user_id: 'S495696'
};
var signature = oauth.hmacsign(method, action, params, consumer_secret);
params.oauth_signature = signature;
var form = document.querySelector("#id_frmConnect");
form.action = action;
form.method = method;
for (var name in params) {
var node = document.createElement("input");
node.type = 'hidden';
node.name = name;
node.value = params[name];
form.appendChild(node);
}
</script>
</body>
</html>
uj5u.com熱心網友回復:
我想通了這個問題。通過使用Saltire 測驗工具,我能夠在使用他們的測驗 URL 時驗證我的簽名是否正確生成:https : //lti.tools/saltire/tp
你可以在這里玩一個例子:https : //learningcom.github.io/ltitest/index.html
因此,在查看了 LinkedIn URL 后,我發現簽名是使用包含引數的不必要的長 URL 生成的。
洗掉: ?application=learning&redirect=https://www.linkedin.com/learning/me
因此,我將 URL 縮短為:
var action = 'https://www.linkedin.com/checkpoint/enterprise/login/[accountID]';
沒有更多的錯誤!
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/394338.html
標籤:javascript 验证 单点登录 链接 升
