0
votes

I implemented JWT Token Authentication in Django rest framework, It gets me token but the problem I am getting is I am not able to authenticate it on the pages which need authentication.

I tried "Authorization: Bearer " after that authenticated url,

I tried "Authorization : JWT Token token"

1
where do you put ~I tried "Authorization : JWT Token token"~ it should be in the headers of your json requestPotato
I put it lke this <127.0.0.1:8000/api/list/12 "Authorization : JWT Token token">Ubaid Parvaiz
The URL and then the authentication.Ubaid Parvaiz

1 Answers

0
votes

JWT token it is used for API authentication only and it should be the javascript or the client side code which handle the API will be used. for example if you use axios in javascript framework you will be putting the token in the api header like this

let config = {
  headers: {
    Authorization: Bearer <my_token>,
  }
}
axios.post(URL, config).then(...)

so if you want to do the authentication in the api and let yourclient code or javascript handle the logic of the authenticate page instead