Boa tarde pessoal,
Estou construindo uma aplicação em Django, onde é necessário que o usuário faça a autenticação através da sua conta Microsoft, para isso, estou utilizando a biblioteca social-auth-app-django.
A autenticação está ocorrendo normalmente, porém não estou conseguindo fazer o usuário se desconectar da aplicação.
Settings.py
AUTHENTICATION_BACKENDS = (
'social_core.backends.azuread.AzureADOAuth2',
'django.contrib.auth.backends.ModelBackend',
)
SOCIAL_AUTH_AZUREAD_OAUTH2_RESOURCE = 'https://graph.microsoft.com/'
SOCIAL_AUTH_LOGIN_ERROR_URL = 'login'
SOCIAL_AUTH_LOGIN_REDIRECT_URL = '/'
SOCIAL_AUTH_RAISE_EXCEPTIONS = False
LOGIN_URL = '/login'
LOGOUT_URL = '/login'
URL_LOGIN = '/login/'
SOCIAL_AUTH_DISCONNECT_PIPELINE = (
'social_core.pipeline.social_auth.social_details',
'social_core.pipeline.social_auth.social_uid',
'social_core.pipeline.social_auth.auth_allowed',
'social_core.pipeline.social_auth.social_user',
'social_core.pipeline.social_auth.associate_user',
'social_core.pipeline.social_auth.load_extra_data',
'social_core.pipeline.user.user_details',
'social_core.pipeline.disconnect.allowed_to_disconnect',
'social_core.pipeline.disconnect.get_entries',
'social_core.pipeline.disconnect.revoke_tokens',
'social_core.pipeline.disconnect.disconnect',
)
URLs.py
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^', include('webapp.core.urls', namespace='core')),
...
url(r'^login/$', auth_views.login, name='login'),
url(r'^logout/$', auth_views.logout, name='logout'),
url(r'^oauth/', include('social_django.urls', namespace='social')),
]
Estou tentando efetuar a desconexão através de POST utilizando CSRF
<form action="{% url 'social:disconnect' 'azuread-oauth2' %}{{ user.id }}/?next=/login" method="post">
{% csrf_token %}
<button class="btn btn-warning btn-xs">
Disconnect
</button>
</form>
Recebo o seguinte erro:
TypeError at /oauth/disconnect/azuread-oauth2/1/
social_details() missing 1 required positional argument: 'response'
Request Method: POST
Request URL: http://localhost:8000/oauth/disconnect/azuread-oauth2/1/?next=/login
Django Version: 1.11.4
Exception Type: TypeError
Exception Value:
social_details() missing 1 required positional argument: 'response'
Exception Location: D:\virtualenv\venv_hercules\lib\site-packages\social_core\backends\base.py in run_pipeline, line 113
Python Executable: D:\virtualenv\venv_hercules\Scripts\python.exe
Python Version: 3.5.2