gpt4 book ai didi

django - 授权凭据被剥离 --- django、elastic beanstalk、oauth

转载 作者:行者123 更新时间:2023-11-28 19:33:16 24 4
gpt4 key购买 nike

我使用 django-rest-framework 在 django 中实现了一个 REST api,并使用 oauth2 进行身份验证。

我测试了:

curl -X POST -d "client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET&grant_type=password&username=YOUR_USERNAME&password=YOUR_PASSWORD" http://localhost:8000/oauth2/access_token/

curl -H "Authorization: Bearer <your-access-token>" http://localhost:8000/api/

在本地主机上获得与文档一致的成功结果。

将其推送到现有 AWS 弹性 beantalk 实例时,我收到:

{ "detail" : "Authentication credentials were not provided." }

最佳答案

我喜欢在标准位置上进行一些额外配置的想法。在您的 .ebextensions 目录中创建一个 wsgi_custom.config 文件:

files:
"/etc/httpd/conf.d/wsgihacks.conf":
mode: "000644"
owner: root
group: root
content: |
WSGIPassAuthorization On

此处发布:https://forums.aws.amazon.com/message.jspa?messageID=376244

关于django - 授权凭据被剥离 --- django、elastic beanstalk、oauth,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22279301/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com