Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django Rest Framework Postman Token Authentication

I am using Django Rest Framework Token authentication and if i do curl http://localhost:8000/api/v1/users/?format=json -H 'Authorization: Token 0a813fdcd3f8846d6fa376f2592bbc678b0b8e85' everything works fine.

But when i try to achieve that with Postman chrome client it nothing happens. What am i doing wrong??

enter image description here

like image 379
psychok7 Avatar asked Oct 28 '14 19:10

psychok7


People also ask

Which authentication is best in Django REST framework?

JSON Web Token Authentication Unlike the built-in TokenAuthentication scheme, JWT Authentication doesn't need to use a database to validate a token. A package for JWT authentication is djangorestframework-simplejwt which provides some features as well as a pluggable token blacklist app.

How do I pass the authorization token in the postman?

The token is a text string, included in the request header. In the request Authorization tab, select Bearer Token from the Type dropdown list. In the Token field, enter your API key value. For added security, store it in a variable and reference the variable by name.


1 Answers

You are setting the header to Authorization: Token when it really should just be Authorization. The header is actually just Authorization, but the value is Token [token_string], where [token_string] is the authorization token that you have obtained.

like image 104
Kevin Brown-Silva Avatar answered Sep 18 '22 05:09

Kevin Brown-Silva