Is Piston ready for OAuth?

本小妞迷上赌 提交于 2019-12-22 08:39:08

问题


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?


回答1:


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?




回答2:


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.



来源:https://stackoverflow.com/questions/1732277/is-piston-ready-for-oauth

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!