- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
当我尝试 http://127.0.0.1/login/twitter 时,我看到它会转到 Twitter 进行身份验证,但我看到以下错误
不正确的身份验证服务
我检查了很多次,TWITTER_CONSUMER_KEY 和 TWITTER_CONSUMER_SECRET 是正确的!
我的设置如下所示
dev.py
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',
)
common.py
""" common settings and globals """
ADMINS = (
('Name', 'email@gmail.com'),
)
MANAGERS = ADMINS
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# On Unix systems, a value of None will cause Django to use the same
# timezone as the operating system.
# If running in a Windows environment this must be set to the same as your
# system time zone.
TIME_ZONE = 'America/Chicago'
# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'
SITE_ID = 1
# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True
# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale.
USE_L10N = True
# If you set this to False, Django will not use timezone-aware datetimes.
USE_TZ = True
# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/media.lawrence.com/media/"
MEDIA_ROOT = ''
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
MEDIA_URL = ''
# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/media.lawrence.com/static/"
STATIC_ROOT = ''
# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"
STATIC_URL = '/static/'
# Additional locations of static files
STATICFILES_DIRS = (
# Put strings here, like "/home/html/static" or "C:/www/django/static".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
)
# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
# Make this unique, and don't share it with anybody.
SECRET_KEY = '=0s02gxrgqpw6zbet@8_usdg4@-=#@4rqxk07k2vn)a24bv&p#'
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
# 'django.template.loaders.eggs.Loader',
)
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
# Uncomment the next line for simple clickjacking protection:
# 'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
ROOT_URLCONF = 'vlists.urls'
# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'vlists.wsgi.application'
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'vlists',
'vlists.apps.playlists',
'vlists.apps.videos',
'vlists.apps.accounts',
# Uncomment the next line to enable the admin:
# 'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
)
# A sample logging configuration. The only tangible logging
# performed by this configuration is to send an email to
# the site admins on every HTTP 500 error when DEBUG=False.
# See http://docs.djangoproject.com/en/dev/topics/logging for
# more details on how to customize your logging configuration.
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
}
},
'handlers': {
'mail_admins': {
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'django.utils.log.AdminEmailHandler'
}
},
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
},
}
}
最佳答案
您的设置文件似乎缺少设置。你需要在那里:
SOCIAL_AUTH_ENABLED_BACKENDS = ('twitter',)
请注意末尾的逗号 - 您需要它,因为它是一个元组。
关于python - Django-社会-auth : Incorrect Authentication Service when using twitter,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10986004/
我在服务器端实现了 oauth token ,但在无效 token 或 token 过期时,我收到 200 http 状态代码,但在响应正文中我有{"code":"4XX", "data":{"som
我正在尝试将 sinatra-authentication gem 添加到 Sinatra 应用程序中,虽然它在那里并完成了它的一部分工作,但由于某种原因,路由似乎没有被添加。代码基础: requir
我有一个健身移动应用程序的想法,我一直在为 iPhone(基于 Obj-C)、Android(基于 Java)、WebOS(基于 html5)和诺基亚 Qt 开发基于这个想法的应用程序。 我现在需要向
我见过有人使用 UUID 生成身份验证 token 。然而,在 RFC 4122据说 Do not assume that UUIDs are hard to guess; they should n
上下文如下。 pouchdb-authentication API没有为此提供明确的方法。我考虑过使用db.getUser(username [, opts][, callback]) 。然而,该方法
Edge 浏览器中的“基本身份验证”没有保存密码的选项。当浏览器关闭并重新打开时,用户必须重新输入密码。 有没有人解决这个问题? 最佳答案 它仍然存在并且仍在工作,他们只是从那些对话框窗口中删除了复选
嗨,我需要知道如何在 iPhone 上使用 oAuth for twitter 自动登录帐户。该应用程序应登录并向用户显示该帐户的提要。 最佳答案 OAuthentication 需要几个阶段,您可以
Edge 浏览器中的“基本身份验证”没有保存密码的选项。当浏览器关闭并重新打开时,用户必须重新输入密码。 有没有人解决这个问题? 最佳答案 它仍然存在并且仍在工作,他们只是从那些对话框窗口中删除了复选
关闭。这个问题是off-topic .它目前不接受答案。 想改进这个问题吗? Update the question所以它是on-topic用于堆栈溢出。 关闭 10 年前。 Improve thi
在尝试运行一些 OpenVAS CLI 命令时,我收到 Failed Authentication 错误消息。 OpenVAS 安装在 CentOS 机器上。我尝试使用用户帐户凭据,但仍然收到相同的错
我正在设计一个 web api。我需要让用户对自己进行身份验证。我有点犹豫让用户以明文形式传递他们的用户名/密码.. 类似于:api.mysite.com/auth.php?user=x&pass=y
我尝试通过 oAuth 在 Spring Security 应用程序中验证用户。我已经收到 token 和用户数据。 如何在没有密码和经典登录表单的情况下手动验证用户? 谢谢你。 最佳答案 像这样的东
我正在 Symfony 4 中创建一个简单的登录身份验证系统并使用安全组件 Guard。我的 FormLoginAuthenticator 如下: router = $router;
我正在开发一个具有多个角色的网络应用程序。我想到了一种方法,可以使用 React Router 通过 onEnter 触发器来限制对某些路由的访问。 现在我想知道这是否是防止访问未经授权的页面的可靠方
我已通读 RFC 2617如果支持多种方案,则无法在那里或其他任何地方找到分隔符。例如,假设支持 Basic 和 Digest。我知道它可能会以这种方式出现: HTTP/1.1 401 Unautho
我在 OWIN Cookie 身份验证方面遇到了一些问题。我有一个 .Net 站点,它有一些 MVC 页面,这些页面使用 cookie 身份验证和受不记名 token 保护的 WebAPI 资源。 当
我正在使用 Telnet 向 Mikrotik 路由器发送命令。 telnet 192.168.100.100 -l admin Password: pass1234 [admin@ZYMMA] >
我管理着一个庞大而活跃的论坛,但我们正被一个非常严重的问题所困扰。我们允许用户嵌入远程图像,就像 stackoverflow 处理图像 (imgur) 的方式一样,但是我们没有一组特定的主机,可以使用
这个真的让我抓狂。 我在 JBoss AS 中有一个 Guvnor(稍后会详细介绍)。我编辑了 components.xml 以启用身份验证(使用 JAAS,我已经很好地设置了用户和密码)和基于角色的
我们有一个管理站点,需要身份验证才能访问。站点上的页面包裹在 Coldfusion 自定义标签中,其中包括所有样式和 JS,以及一些其他信息。 我最近制作了一份自定义标签包装器的副本。我将副本放在与原
我是一名优秀的程序员,十分优秀!