简体   繁体   English

将 xAPI 语句发送到 Web 应用程序而不是 LRS

[英]Sending xAPI statement to a web application instead of LRS

I have an xAPI content made by storyline I want for the statement to be sent to a webapp instead of the LRS.我有一个由故事情节制作的 xAPI 内容,我希望将语句发送到 webapp 而不是 LRS。 this webapp is developped using laravel, and user should be authenticated with email and password to use it.这个 webapp 是使用 laravel 开发的,用户应该通过电子邮件和密码进行身份验证才能使用它。 what I did to send the statement to this app:我做了什么将声明发送到这个应用程序:

1.in the webapp I created an API endpoint route that use POST method. 1.在 webapp 中,我创建了一个使用 POST 方法的 API 端点路由。

2.in the xAPI wrapper I changed the endpoint in the configuration to the route I made in the webapp. 2.在 xAPI 包装器中,我将配置中的端点更改为我在 webapp 中创建的路由。

const conf = {
        "endpoint":"here I added my api endpoint route of the webapp",
        "auth":"Basic " + toBase64(""),
    }

now whith any interaction with the content where a statement should be sent the request making cors error like in the picture down, I think this is authentication error, how can I add my authentication credentials to the xAPI wrapper?现在,与应该发送语句的内容的任何交互都会产生如图所示的 cors 错误,我认为这是身份验证错误,如何将我的身份验证凭据添加到 xAPI 包装器中?

在此处输入图像描述

Your non-LRS LRS is probably not handling preflight requests which are necessary for CORS handling.您的非 LRS LRS 可能未处理 CORS 处理所需的预检请求。 Most common LRSs will handle those requests appropriately since they expect to be accessed from additional origins.大多数常见的 LRS 将适当地处理这些请求,因为它们希望从其他来源进行访问。 See https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#preflighted_requests请参阅https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#preflighted_requests

Also note that you'll likely run into issues unless you also handle state requests.另请注意,除非您还处理状态请求,否则您可能会遇到问题。

Additionally unless you are requesting the credentials from the user during runtime then hard coding the credentials into the package isn't a great idea from a security perspective.此外,除非您在运行时向用户请求凭据,否则从安全角度来看,将凭据硬编码到包中并不是一个好主意。

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

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