简体   繁体   English

LinkedIn Learning LTI 身份验证失败

[英]LinkedIn Learning LTI failed authentication

I'm attempting to integrate LinkedIn Learning Single-Sign-On via an LTI connection, however I'm always faced with the response: LTI_FAILED_AUTHENTICATION .我正在尝试通过LTI连接集成 LinkedIn Learning Single-Sign-On,但是我总是面临以下响应: LTI_FAILED_AUTHENTICATION

LinkedIn Learning - LTI_FAILED_AUTHENTICATION领英学习 - LTI_FAILED_AUTHENTICATION

When I test it out on the Saltire test platform, it strangely works.当我在Saltire测试平台上测试它时,它奇怪地工作。

The parameters match what I am sending from the code below: Saltire LTI Success authentication参数与我从以下代码发送的内容相匹配: Saltire LTI Success authentication

Have tried copying over the the values of oauth_nonce , timestamp and oauth_signature from Saltire to my page, and that worked also, which scores out the possibility of domain whitelisting requirement.尝试将oauth_noncetimestampoauth_signature的值从 Saltire 复制到我的页面,这也有效,这排除了域白名单要求的可能性。

LinkedIn support have come back saying there seems to be something wrong with the generated signature, but I'm not sure what is wrong about it, since that is generated by the parameters passed. LinkedIn 支持人员回来说生成的签名似乎有问题,但我不确定它有什么问题,因为这是由传递的参数生成的。

Is there something incorrectly setup from my page which I am not seeing?我的页面是否有一些我没有看到的错误设置?

<!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>

I figured out the issue.我弄清楚了这个问题。 By using the Saltire test tool , I was able to verify that my signature was generated correctly when using their testing URL: https://lti.tools/saltire/tp通过使用Saltire 测试工具,我能够在使用他们的测试 URL: https://lti.tools/saltire/tp时验证我的签名是否正确生成

You can play with an example here: https://learningcom.github.io/ltitest/index.html你可以在这里玩一个例子: https://learningcom.github.io/ltitest/index.html

So after looking at the LinkedIn URL, I discovered that the signature was getting generated with an unnecessary long URL which contained parameters .因此,在查看了 LinkedIn URL 之后,我发现生成的签名带有不必要的长 URL ,其中包含参数

Removed: ?application=learning&redirect=https://www.linkedin.com/learning/me删除: ?application=learning&redirect=https://www.linkedin.com/learning/me

Therefore, I shortened the URL to:因此,我将 URL 缩短为:

var action = 'https://www.linkedin.com/checkpoint/enterprise/login/[accountID]';

No more errors!没有更多的错误!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM