Piston 准备好接受 OAuth 了吗?

发布于 2024-08-10 23:37:45 字数 291 浏览 3 评论 0原文

我尝试使用 Piston 来实现简单的 API,希望能够使用其 OAuth 支持。但启用 OAuth 后第一次访问端点时,出现错误:

TemplateDoesNotExist: oauth/challenge.html

果然,没有这样的文件。

OAuth 在活塞中工作吗?我犯了一个愚蠢的错误吗?

I tried using Piston for a simple API, hoping to use its OAuth support. But the first time I hit the endpoint after enabling OAuth, I got an error:

TemplateDoesNotExist: oauth/challenge.html

and sure enough, there is no such file.

Does OAuth work in Piston? Am I making a stupid mistake?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

作妖 2024-08-17 23:37:45

不——这看起来像是活塞的一个错误。 oauth/challenge.html 被引用 此处,但在该项目中的任何地方都不存在(请参阅 Piston 的 模板文件夹)。

您可以尝试在 TEMPLATE_DIRS 设置?

Nope - that looks like a bug in Piston. oauth/challenge.html is referenced here, but does not exist anywhere in that project (see Piston's templates folder).

Could you try creating an empty oauth/challenge.html file somewhere in one of your directories specified in TEMPLATE_DIRS setting?

煞人兵器 2024-08-17 23:37:45

当检查 is_authenticated 失败时,将调用身份验证对象中的challenge 方法。我还没有对此进行测试,但我相信在授权失败并且需要显示错误时很可能会呈现challenge.html。

这只是一个猜测,但我认为这是有道理的。

The challenge method in the authentication object is called when checking is_authenticated fails. I haven't tested this, but I am led to believe that challenge.html is most likely rendered when authorization has failed and an error needs to be displayed.

This is only a guess, but I think that it makes sense.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文