我在django中使用django-rest-framework实现了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 Elastic beantalk实例时,我收到了:
{ "detail" : "Authentication credentials were not provided." }