I'm working on a little Django app where users are able to connect to Facebook and Google after they login. However, I'm unable so far to disconnect users. When clicking on disconnecting it just goes to a white page and it shows error 405.
This is my template:
{% if conectado %}
<p>Estás conectado a Facebook (<a href="{% url 'social:disconnect_individual' 'facebook' conectado.id %}?next={{ request.path }}">Desconectar</a>)</p>
{% else %}
<a href="{% url 'social:begin' 'facebook' %}?next={{ request.path }}">Conectar con Facebook</a>
{% endif %}
{% if conectado_google %}
<p>Estás conectado a Google (<a href="{% url 'social:disconnect_individual' 'google-oauth2' conectado_google.id %}?next={{ request.path }}">Desconectar</a>)</p>
{% else %}
<a href="{% url 'social:begin' 'google-oauth2' %}?next={{ request.path }}">Conectar con Google </a>
{% endif %}
Any help is appreciated!
HTTP 405 stands for Method Not Allowed.
The disconnect endpoint needs to use a POST
request and not a GET
. Try using a <form>
instead of an <a>
tag:
<form action="{% url 'social:disconnect_individual 'google-oauth2' google.id %}" method="POST">
<button type="submit">Disconnect</button>
</form>