Authentication using social media requires an extra module in the project.
The server did not find an intermediary to do this and due to missing return this warning.
I state the social-auth-app-Django, to make this authentication,not only for mentioned social network more for which other want.
its configuration is well explained on the official page page
after completing the installation: Pip install social-auth-app-Django
It will be necessary to register in apps
INSTALLED_APPS = (
...
'social_django',
...
)
On the official page, "There is a context processor that will add back-ends and association data to the model context:":
this means that through the social_django will be added in the authentication context templates as name photo
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': ['templates'],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'social_django.context_processors.backends',#<==1
'social_django.context_processors.login_redirect',#<==2
],
},
},
]
specify authentication by social network and no longer by Django
AUTHENTICATION_BACKENDS = [
'social_core.backends.facebook.FacebookOAuth2',
]
Settings of the app developer facebook, when using this feature will not be recreated a new authentication for the user after logging out and start login again
SOCIAL_AUTH_FACEBOOK_KEY = 'sua chave'
SOCIAL_AUTH_FACEBOOK_SECRET = 'codigo'
SOCIAL_AUTH_FACEBOOK_SCOPE = ['email', 'user_link'] #parametros a extrair
SOCIAL_AUTH_FACEBOOK_PROFILE_EXTRA_PARAMS = {
'fields': 'id, name, email, picture.type(large), link'
}
SOCIAL_AUTH_FACEBOOK_EXTRA_DATA = [
('name', 'name'),
('email', 'email'),
('picture', 'picture'),
('link', 'profile_url'),
]
view login explanation page:
from django.views.generic import TemplateView
class LoginView(TemplateView):
template_name = 'login.html'
in the app url:
from django.urls import path, include
from django.contrib.auth import views as auth_views # autenticação de views
from .views import LoginView# campos de login
urlpatterns = [
path('login/', LoginView.as_view(), name='login'),
path('logout/', auth_views.LogoutView.as_view(), name='logout'),# logout
path('social-auth/', include('social_django.urls', namespace='social')), # api extra
]
html authentication using social network and not the Django standard:
<a href="{% url 'social:begin' 'facebook' %}">rede social</a>
</button>
iniciar
<button>
you need an extra module!
– stack.cardoso
Ok ... How and where to make this extra module /
– Chuck.h5