0

I try to create an admin user in my application, but even I do not include any code, it gives the error 'CSRF token missing or incorrect'. I can't find what to do. Can anyone solve this problem?

I tried all the suggestions from my friends, and Django documentation, but none of them could solve it.

Actually, there is no need to paste my code, because as I mentioned before even without any HTML templates it is not possible to create an admin user.

enter image description here

Yunusov
  • 38
  • 5
  • You didn't like this answer? https://stackoverflow.com/questions/26639169/csrf-failed-csrf-token-missing-or-incorrect , cf https://stackoverflow.com/questions/8089224 – J_H Jul 26 '19 at 00:11
  • 2
    Possible duplicate of [CSRF Failed: CSRF token missing or incorrect](https://stackoverflow.com/questions/26639169/csrf-failed-csrf-token-missing-or-incorrect) – J_H Jul 26 '19 at 00:11
  • Can you add any screenshot or details about the problem which you have faced? – Fatema Tuz Zuhora Jul 26 '19 at 02:39
  • @FatemaT.Zuhora, I added the screenshot to the post. But please note that even I start a project from scratch, with no template or code, I got the same error. – Yunusov Jul 26 '19 at 03:11
  • So let me clear one thing, yo just start a new project and want to visit `localhost:8000/admin`. After submitting the username and password you saw the following error. Is it? – Fatema Tuz Zuhora Jul 26 '19 at 03:25

1 Answers1

0

Admin login normally does require a CSRF token, but that's usually all taken care for you. Despite being as you have faced the following problem, this could be generating from your browser extensions.

  • Check your browser's cookies to see if there is a CSRF token present
  • Try clearing all the cookies, disabling the browser extensions and refreshing

OR just try from another browser which does not have any extensions and cookies are present.

Fatema Tuz Zuhora
  • 3,088
  • 1
  • 21
  • 33