使用 django-allauth 和 Stack Exchange 作为提供者,如何在我的开发环境中更改 redirect_uri?
Using django-allauth and Stack Exchange as a provider, how can I change the redirect_uri in my development environment?
我正在尝试使用 allauth
插件和 Stack Exchange 作为提供者。
我有以下设置:
INSTALLED_APPS = [
...
# The Django sites framework is required
'django.contrib.sites',
'allauth',
'allauth.account',
'allauth.socialaccount',
'allauth.socialaccount.providers.stackexchange',
]
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
...
# Required by `allauth` template tags
'django.core.context_processors.request',
],
},
},
]
SOCIALACCOUNT_PROVIDERS = {
'stackexchange': {
'SITE': 'Whosebug'
}
}
我在 Stack Apps 上注册了一个应用程序,它没有使用 "Client Side Flow",我已经在 Django 管理面板中配置了我的客户端 ID 和密钥。
但是,在我的开发环境中,如何强制登录重定向回我的本地主机?现在,我收到此错误:
error description: Cannot return to provided redirect_uri
For local development you can simply use “localhost” for the OAuth domain.
这是什么意思,我该如何实现?
只需将您要重定向的页面添加到您的设置
#settings.py
LOGIN_REDIRECT_URL = '/example'
我正在尝试使用 allauth
插件和 Stack Exchange 作为提供者。
我有以下设置:
INSTALLED_APPS = [
...
# The Django sites framework is required
'django.contrib.sites',
'allauth',
'allauth.account',
'allauth.socialaccount',
'allauth.socialaccount.providers.stackexchange',
]
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
...
# Required by `allauth` template tags
'django.core.context_processors.request',
],
},
},
]
SOCIALACCOUNT_PROVIDERS = {
'stackexchange': {
'SITE': 'Whosebug'
}
}
我在 Stack Apps 上注册了一个应用程序,它没有使用 "Client Side Flow",我已经在 Django 管理面板中配置了我的客户端 ID 和密钥。
但是,在我的开发环境中,如何强制登录重定向回我的本地主机?现在,我收到此错误:
error description: Cannot return to provided redirect_uri
For local development you can simply use “localhost” for the OAuth domain.
这是什么意思,我该如何实现?
只需将您要重定向的页面添加到您的设置
#settings.py
LOGIN_REDIRECT_URL = '/example'