【发布时间】:2022-01-23 02:07:24
【问题描述】:
我正在尝试通过LTI 连接集成LinkedIn Learning Single-Sign-On,但我总是遇到以下响应:LTI_FAILED_AUTHENTICATION。
LinkedIn Learning - 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>
【问题讨论】:
标签: javascript authentication single-sign-on linkedin lti