Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to use the browsable API for Django Rest Framework with Authtoken

How can I use the Django Rest Framework browsable API for a particular user by authenticating via authtoken (instead of username/pwd)? The same way I would do for POSTMAN in Chrome

Thanks

like image 274
dowjones123 Avatar asked Nov 19 '14 00:11

dowjones123


People also ask

What is browsable API in Django REST Framework?

The browsable API feature in the Django REST framework generates HTML output for different resources. It facilitates interaction with RESTful web service through any web browser. To enable this feature, we should specify text/html for the Content-Type key in the request header.

How can you secure the Django REST Framework based REST API?

User token endpoint The Django rest framework comes with an endpoint that users can use to generate their authentication tokens by providing their valid username and password. In the django_todo project directory add the API endpoint for token generation in the urls.py file.

How do I add login to the browsable API provided by DRF?

Adding login to the Browsable API We can add a login view for use with the browsable API, by editing the URLconf in our project-level urls.py file. And, at the end of the file, add a pattern to include the login and logout views for the browsable API.


1 Answers

Check modheader. It allows you to set headers for your request. You can set the token authtoken there where "Name" would be "Authorization" and "Value" would be "Token <your_token>"

like image 191
argaen Avatar answered Oct 01 '22 04:10

argaen