WSGIAUTHORIZATION

54 views
Skip to first unread message

narendra...@gmail.com

unread,
Dec 11, 2020, 6:48:14 AM12/11/20
to Django users
Do we need to do WSGIAUTHORIZATION ON in order to authorize a jwt token.
I am getting "detail": "Authentication credentials were not provided." while sending a authorizationtoken and 403 forbidden. can somebodyhelp me out.

Nitin Kalmaste

unread,
Dec 11, 2020, 8:01:23 AM12/11/20
to django...@googlegroups.com
Check weather sending token in a proper way ither in terms of authorization or as a bearer token.  It depends on what backend you are using.

On Fri, 11 Dec 2020, 12:19 pm narendra...@gmail.com, <narendra...@gmail.com> wrote:
Do we need to do WSGIAUTHORIZATION ON in order to authorize a jwt token.
I am getting "detail": "Authentication credentials were not provided." while sending a authorizationtoken and 403 forbidden. can somebodyhelp me out.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/fd2b35cd-2866-4f6b-a28a-46e25b0f19afn%40googlegroups.com.

narendra thapa

unread,
Dec 11, 2020, 9:48:52 AM12/11/20
to django...@googlegroups.com
I am using JWT <token>. I can get the access and refresh token and while i resent the access token Authorization : JWT <access_token> it send 403 forbidden. I am using DJOSER and simple JWT for authentication and authorization.

Nitin Kalmaste

unread,
Dec 11, 2020, 11:18:02 AM12/11/20
to django...@googlegroups.com
Can you share some of your code so we can figure it out? As early as possible

narendra thapa

unread,
Dec 11, 2020, 1:40:30 PM12/11/20
to django...@googlegroups.com
elearnings.zip

Nitin Kalmaste

unread,
Dec 11, 2020, 2:41:45 PM12/11/20
to django...@googlegroups.com
Have you followed the official documentation? i dont't see that you have used any settings 

Nitin Kalmaste

unread,
Dec 11, 2020, 2:42:37 PM12/11/20
to django...@googlegroups.com
Getting started — djoser 2.0.1 documentation -- Use this as a reference and start your project

narendra thapa

unread,
Dec 11, 2020, 2:51:48 PM12/11/20
to django...@googlegroups.com
I have followed the documentation. and done all the thing that i could do. i am getting access token but not able to authorize
here is my code in stackoverflow please check it once. I have followed a tutorial for the same in that he is able to access but i got stuck.
for frontend i'm using the React js


Nitin Kalmaste

unread,
Dec 11, 2020, 3:03:59 PM12/11/20
to django...@googlegroups.com
Can You send me json request details, how you are sending data to server
using react

narendra thapa

unread,
Dec 11, 2020, 3:31:48 PM12/11/20
to django...@googlegroups.com
const config1 = {
headers:{
'Content-Type':'application/json',
'Authorization':`JWT ${res.data?.access}`,
'Accept':'application/json'
}
}
console.log('hello',config1)
try{
const res1 = axios.get(`http://localhost:8000/auth/users/me/`,config1).then(
response => response
)
console.log(res1);
}catch(err){
console.log(err)
}

narendra thapa

unread,
Dec 11, 2020, 3:33:52 PM12/11/20
to django...@googlegroups.com
i have used postman also to check the endpoint but same problem. I think problem is in django backend not in react.

Nitin Kalmaste

unread,
Dec 11, 2020, 5:33:30 PM12/11/20
to django...@googlegroups.com
There is space between jwt and token i.e. Authorization: jwt <token>

narendra thapa

unread,
Dec 12, 2020, 1:57:47 AM12/12/20
to django...@googlegroups.com
shall i remove the space between it or what. According we need to give onespace between jwt <access_token> right


narendra thapa

unread,
Dec 12, 2020, 2:17:13 AM12/12/20
to django...@googlegroups.com
Nothing works for me tried everything, always throws a forbidden. Djoser documentation says support upto Djnago-restframework V11 but i have got V12. Is that a problem or what. I am not able to figure it out.

narendra thapa

unread,
Dec 12, 2020, 3:22:52 AM12/12/20
to django...@googlegroups.com
yeah i figured out the problem bro thank you very @Nitin Kalmaste much giving your previous time. 

Nitin Kalmaste

unread,
Dec 12, 2020, 3:44:15 AM12/12/20
to django...@googlegroups.com

narendra thapa

unread,
Dec 12, 2020, 6:09:16 AM12/12/20
to django...@googlegroups.com
TYPO ERROR in Rest_Framework :{
'Default_Atuhentication_classes, I wrote authentication 

Reply all
Reply to author
Forward
0 new messages