Djangosocialauth:使用twi时身份验证服务不正确

2024-04-19 21:17:29 发布

您现在位置:Python中文网/ 问答频道 /正文

当我尝试http://127.0.0.1/login/twitter,我看到它会转到Twitter进行身份验证,但我看到以下错误
不正确的身份验证服务

我检查了很多次,TWITTER_CONSUMER_KEY和TWITTER_CONSUMER_SECRET都是正确的!在

我的设置如下所示
开发人员

INSTALLED_APPS += (
    'social_auth',
)

AUTHENTICATION_BACKENDS = (
    'social_auth.backends.twitter.TwitterBackend',
    'django.contrib.auth.backends.ModelBackend',
)

TWITTER_CONSUMER_KEY         = 'correct key'
TWITTER_CONSUMER_SECRET      = 'correct secret'

SOCIAL_AUTH_CREATE_USERS          = True
SOCIAL_AUTH_FORCE_RANDOM_USERNAME = False
SOCIAL_AUTH_DEFAULT_USERNAME = 'John'
SOCIAL_AUTH_COMPLETE_URL_NAME  = 'socialauth_complete'
SOCIAL_AUTH_ASSOCIATE_URL_NAME = 'socialauth_associate_complete'

#LOGIN_URL          = '/login-form/'
LOGIN_REDIRECT_URL = '/'
LOGIN_ERROR_URL    = '/login/error/'

TEMPLATE_CONTEXT_PROCESSORS = (
    'social_auth.context_processors.social_auth_by_name_backends',
    'social_auth.context_processors.social_auth_by_type_backends',
)

SOCIAL_AUTH_PIPELINE = (
    'social_auth.backends.pipeline.social.social_auth_user',
    'social_auth.backends.pipeline.associate.associate_by_email',
    'social_auth.backends.pipeline.misc.save_status_to_session',
    'app.pipeline.redirect_to_form',
    'app.pipeline.username',
    'social_auth.backends.pipeline.user.create_user',
    'social_auth.backends.pipeline.social.associate_user',
    'social_auth.backends.pipeline.social.load_extra_data',
    'social_auth.backends.pipeline.user.update_user_details',
)  

普通.py

^{pr2}$

Tags: authurlbypipelineconsumerloginsocialtwitter