如何解决我总是使用社区EC2 AMI机器通过xAPI for Learning Locker收到401未经授权的响应
我已经在AWS EC2上配置了Learning Locker,并已将已构建的社区AMI与Ubuntu 16.04结合使用。我可以访问该URL,并且可以登录系统并使用它。我进去创建了客户端,并使用默认的组织。
我在每个请求中都按照文档传递了Authorization令牌,但我仍然遭到401的未授权。
我什至按照文档中共享的支持视频进行声明和陈述,但它们甚至对我都不起作用。
从现在起两天我一直在努力,因此需要协助。我使用CURL和Insomnia软件进行了尝试,但响应仍然相同。由于我处于测试设置中,因此即使共享确切的令牌也不必介意。还有CURL请求。
这是我使用的CURL请求
curl -H "Authorization: Basic NDk0MTdjYmUzMDQ3YzkyOWJkOTIzMWUxOWM2YmYwZjZhNzMyMmE0YTpjMzYyZWFlYTU5ZjgwMjAxY2VjYjQ4NjIxY2EyMGQ2NmIwNmU4ZDE4" -H "X-Experience-API-Version: 1.0.3" -H "Content-Type: application/json" -X POST http://ec2-18-185-127-9.eu-central-1.compute.amazonaws.com/data/xAPI/activities/state --data "activityId=http%3A%2F%2Fwww.example.org%2Factivity&agent=%7B%22mbox%22%3A%20%22mailto%3Atest%40example.org%22%7D&stateId=example_state_id®istration=361cd8ef-0f6a-40d2-81f2-b988865f640c"
以下是响应:{"errorId":"7fe46a1d-e46e-4a22-ad21-399c6bb16e6a","message":"Unauthorised"}
唯一成功的呼叫是对/data/xAPI/about
的呼叫,它给出以下响应
{
"X-Experience-API-Version": "1.0.3","version": [
"1.0.3"
]
}
学习储物柜状态
ubuntu@ip-172-31-33-77:~$ sudo su learninglocker
learninglocker@ip-172-31-33-77:/home/ubuntu$ pm2 status
┌─────┬──────────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id │ name │ namespace │ version │ mode │ pid │ uptime │ ↺ │ status │ cpu │ mem │ user │ watching │
├─────┼──────────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 0 │ API │ default │ 2.0.0 │ cluster │ 1501 │ 47h │ 0 │ online │ 0.3% │ 105.7mb │ lea… │ enabled │
│ 3 │ Scheduler │ default │ 2.0.0 │ cluster │ 1949 │ 47h │ 0 │ online │ 0% │ 78.0mb │ lea… │ enabled │
│ 1 │ UIServer │ default │ 2.0.0 │ cluster │ 1502 │ 47h │ 0 │ online │ 0.3% │ 80.2mb │ lea… │ enabled │
│ 2 │ Worker │ default │ 2.0.0 │ cluster │ 1910 │ 47h │ 0 │ online │ 0.3% │ 106.3mb │ lea… │ enabled │
│ 4 │ xAPI │ default │ 0.0.0-… │ cluster │ 1978 │ 47h │ 0 │ online │ 0% │ 70.9mb │ lea… │ enabled │
│ 5 │ xAPI │ default │ 0.0.0-… │ cluster │ 2027 │ 47h │ 0 │ online │ 0.3% │ 71.6mb │ lea… │ enabled │
└─────┴──────────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
学习储物柜日志
learninglocker@ip-172-31-33-77:/home/ubuntu$ pm2 logs xAPI
[TAILING] Tailing last 15 lines for [xAPI] process (change the value with --lines option)
/var/log/learninglocker/xapi_stdout-4.log last 15 lines:
4|xAPI | 2020-04-22 10:28:57:549 - info: Listening on port 8081
4|xAPI | 2020-04-22 10:28:57:553 - info: Process ready
4|xAPI | 2020-04-22 10:28:57:600 - info: Created new Mongo connection
4|xAPI | 2020-08-26 12:13:23:946 - info: Listening on port 8081
4|xAPI | 2020-08-26 12:13:23:952 - info: Process ready
4|xAPI | 2020-08-26 12:13:24:008 - info: Created new Mongo connection
4|xAPI | 2020-08-26 19:57:44:805 - info: Created new Mongo connection
/var/log/learninglocker/xapi_stdout-5.log last 15 lines:
5|xAPI | 2020-04-22 10:28:59:426 - info: Listening on port 8081
5|xAPI | 2020-04-22 10:28:59:429 - info: Process ready
5|xAPI | 2020-04-22 10:28:59:468 - info: Created new Mongo connection
5|xAPI | 2020-08-26 12:13:23:943 - info: Listening on port 8081
5|xAPI | 2020-08-26 12:13:23:952 - info: Process ready
5|xAPI | 2020-08-26 12:13:24:014 - info: Created new Mongo connection
5|xAPI | 2020-08-26 20:11:38:514 - info: Created new Mongo connection
5|xAPI | 2020-08-27 15:01:13:192 - info: Created new Mongo connection
/var/log/learninglocker/xapi_stderr-5.log last 15 lines:
5|xAPI | 2020-08-26 21:06:39:195 - error: 17200f4e-d98d-48ba-b09b-ea447fa68b05: jscommons handled - Unauthorised
5|xAPI | 2020-08-26 21:14:59:778 - error: e9ae78fd-943a-4647-b310-ad101ba913d4: xapi-statements handled - Method (undefined) is invalid for alternate request syntax
5|xAPI | 2020-08-26 21:42:05:999 - error: 078ef7b8-b33b-4280-8565-747994ed1e73: jscommons handled - Unauthorised
5|xAPI | 2020-08-26 21:56:08:157 - error: c6a21e87-1215-4b04-91dd-b510b52d6364: jscommons handled - Unauthorised
5|xAPI | 2020-08-26 22:02:50:626 - error: fd56c95b-b9c5-4178-8d18-6f35141490d6: jscommons handled - Unauthorised
5|xAPI | 2020-08-26 22:03:25:201 - error: 1b38c501-449a-411e-a347-4dc9b2d642ca: jscommons handled - Unauthorised
5|xAPI | 2020-08-26 22:11:56:776 - error: 651244b9-31ee-437c-abf5-7dbf2210e2a4: jscommons handled - Unauthorised
5|xAPI | 2020-08-26 22:12:18:698 - error: d6cd8b7a-bd15-4692-84df-a5f3c3ec9b9f: jscommons handled - Unauthorised
5|xAPI | 2020-08-26 22:13:04:239 - error: e9a37180-da2e-456b-8408-92817f78c9e3: jscommons handled - Unauthorised
5|xAPI | 2020-08-26 22:24:04:922 - error: 7fe46a1d-e46e-4a22-ad21-399c6bb16e6a: jscommons handled - Unauthorised
5|xAPI | 2020-08-26 22:33:49:707 - error: 49c9671e-b029-408b-8b81-cfcd38308fdb: jscommons handled - Unauthorised
5|xAPI | 2020-08-26 22:46:18:820 - error: 4955d956-8b33-4be6-b3bd-3931f9249bae: jscommons handled - Unauthorised
5|xAPI | 2020-08-26 22:49:33:257 - error: 4f0fadbf-122e-4412-8967-c5995bf74b35: jscommons handled - Unauthorised
5|xAPI | 2020-08-26 23:48:56:248 - error: ed0c1692-f6b2-4190-9645-d09389c9cf9b: jscommons handled - Unauthorised
5|xAPI | 2020-08-27 15:01:13:225 - error: 32028e87-e844-4a01-8136-a6a2a2ee53b9: jscommons handled - Unauthorised
/var/log/learninglocker/xapi_stderr-4.log last 15 lines:
4|xAPI | 2020-08-26 21:08:32:861 - error: 4311e4ac-bdcd-4765-98db-a9292e8d921b: jscommons handled - Unauthorised
4|xAPI | 2020-08-26 21:14:16:597 - error: 4a3dda4a-d5f9-49d5-b78f-1ab7b4bac731: xapi-statements handled - Method (undefined) is invalid for alternate request syntax
4|xAPI | 2020-08-26 21:52:58:594 - error: 2dda9bd1-c1f2-4635-9ff6-f7865163824a: jscommons handled - Unauthorised
4|xAPI | 2020-08-26 21:58:22:651 - error: f45b92c0-6403-439e-9783-0384d22a352b: jscommons handled - Unauthorised
4|xAPI | 2020-08-26 22:03:16:466 - error: f4b494e2-6daf-485e-9c63-65febf4d1dab: jscommons handled - Unauthorised
4|xAPI | 2020-08-26 22:11:45:122 - error: 0dcbcc49-2b69-45a2-91e8-e8d8422cbcc4: jscommons handled - Unauthorised
4|xAPI | 2020-08-26 22:12:45:131 - error: d662c18e-8c0a-4efd-b3b5-9c13cc236c57: jscommons handled - Unauthorised
4|xAPI | 2020-08-26 22:13:11:537 - error: da431a2c-a157-4695-a808-90381bf99113: jscommons handled - Unauthorised
4|xAPI | 2020-08-26 22:25:27:984 - error: 53926e82-0d1f-45a2-8a70-f4c3b7c43e64: jscommons handled - Unauthorised
4|xAPI | 2020-08-26 22:33:27:589 - error: 93e21ba1-0c06-4721-868f-6205b13a0009: jscommons handled - Unauthorised
4|xAPI | 2020-08-26 22:35:41:287 - error: 7512a719-d25b-4852-a40e-9a8c6f5d2300: jscommons handled - Unauthorised
4|xAPI | 2020-08-26 22:47:03:308 - error: 7a5aab9e-8675-4588-b720-ccf422f61f42: jscommons handled - Unauthorised
4|xAPI | 2020-08-26 23:27:07:862 - error: c54e4396-33f3-4cfa-8141-79db6cfa130b: jscommons handled - Unauthorised
解决方法
您需要至少创建一个商店,并在客户端设置中指定它。
- 登录到您的组织。
- 选择设置>存储。
- 单击“添加新项”(以添加新的记录存储)。
- 填写名称/说明。
- 然后返回到“客户”菜单。
- 在客户详细信息中指定LRS和范围。
我不特别了解Learning Locker,但是我不认为Authorization标头的显示值正确,至少我不希望它基于显示的密钥和机密。的base64编码值:
NDk0MTdjYmUzMDQ3YzkyOWJkOTIzMWUxOWM2YmYwZjZhNzMyMmE0YTppNDND0
解码为:
49417cbe3047c929bd9231e19c6bf0f6a7322a4a:c49417cbe3047c929bd9231e19c6bf0f6a7322a4a:c362eaea59f80201cecb48621ca20d66b06e8d18
其中似乎还有一个额外的细分c49417cbe3047c929bd9231e19c6bf0f6a7322a4a
您可以尝试使用具有以下值的标头:
NDk0MTdjYmUzMDQ3YzkyOWJkOTIzMWUxOWM2YmYwZjZhNzMyMmE0YTpjMzYyZWFlYTU5ZjgwMjAxY2VjYjQ4NjIxY2EyMGQ2NmIwNmU4ZDE4
其中基于密钥和秘密,然后基于base64编码
49417cbe3047c929bd9231e19c6bf0f6a7322a4a:c362eaea59f80201cecb48621ca20d66b06e8d18
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。