Forbidden (403) - CSRF verification failed. Request aborted.

1,021 views
Skip to first unread message

Carlos Roberto

unread,
Nov 22, 2022, 6:58:41 PM11/22/22
to Django users
Hi everyone!

I use ngrok to make my projects available in django. I'm having trouble accessing the admin page. After I enter the username and password I get the error 403.

Has anyone had the same problem and could help me?

Regards


Chukwudi Onwusa

unread,
Nov 22, 2022, 9:03:49 PM11/22/22
to django...@googlegroups.com
Check your template, immediately after the <form> opening tag add  
{% csrf_token %}
If you have it already, kindly check to ensure it's correctly spelt and placed and then restart your server.
Best Regards.

--
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/de5c4738-f540-4596-b1bf-0b0b16aabbf2n%40googlegroups.com.


--
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/de5c4738-f540-4596-b1bf-0b0b16aabbf2n%40googlegroups.com.

Nagaraja Tuticorin

unread,
Nov 23, 2022, 9:22:06 AM11/23/22
to django...@googlegroups.com
Make your database as a public make format of database chmod www-data=www-data ./filename 

Nagaraja Tuticorin

unread,
Nov 23, 2022, 9:22:14 AM11/23/22
to django...@googlegroups.com
Make your database as a public make format of database chmod www-data=www-data ./filename 

Mark Gensler

unread,
Nov 25, 2022, 11:58:59 AM11/25/22
to Django users
Try adding your ngrok domain to the list of CSRF_TRUSTED_ORIGINS: https://docs.djangoproject.com/en/4.1/ref/settings/#csrf-trusted-origins

E.g. assuming you're using https:

CSRF_TRUSTED_ORIGINS = ["https://*.ngrok.io"]
Reply all
Reply to author
Forward
0 new messages