python - Django restframework browsable api login with ouath -
i have created sample api using djangorestframework worked fine , utilize browsable api without problem. added outh2 authentication mentioned on official website worked fine. can utilize next access token.
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/
i can utilize curl browse api using access token.
but while using browsable api can't browse api due obvious reason browsable api neither getting access token nor using any. think need have login this. not getting can customise current login having utilize oauth.
web browsers don't allow set custom headers, there's no way can provide oauth token.
in general, if want utilize browsable api need allow session based (i.e. cookie based auth).
you can allow both authentication methods, perhaps restricting session auth development if that's necessary.
i hope helps.
python django django-rest-framework
No comments:
Post a Comment