Authorization Credentials Stripped — django, elastic beanstalk, oauth

后端 未结 4 1127
无人及你
无人及你 2020-12-02 07:31

I implemented a REST api in django with django-rest-framework and used oauth2 for authentication.

I tested with:

curl -X POST -d \"client_id=YOUR_CLI         


        
4条回答
  •  醉梦人生
    2020-12-02 08:13

    I use a slightly different approach now. sahutchi's solution worked as long as env variables were not changed as Tom dickin pointed out. I dug a bit deeper inside EB and found out where the wsgi.conf template is located and added the "WSGIPassAuthorization On" option there.

    commands:
      WSGIPassAuthorization:
        command: sed -i.bak '/WSGIScriptAlias/ a WSGIPassAuthorization On' config.py
        cwd: /opt/elasticbeanstalk/hooks
    

    That will always work, even when changing environment variables. I hope you find it useful.

    Edit: Seems like lots of people are still hitting this response. I haven't used ElasticBeanstalk in a while, but I would look into using Manel Clos' solution below. I haven't tried it personally, but seems a much cleaner solution. This one is literally a hack on EBs scripts and could potentially break in the future if EB updates them, specially if they move them to a different location.

提交回复
热议问题