标签: django-socialauth

为什么django-social-auth在登录时不考虑下一个变量?

如果我在没有登录的情况下直接访问某个页面(需要用户登录),Django的身份验证框架会将我带到登录页面,然后根据next变量中的值重定向到我请求的页面.

然而,django-social-auth事实并非如此吗?我已经实现了django-social-auth,我可以看到nextURL 中的变量已正确填充.但是当我最终使用Facebook登录时,它会将我重定向到LOGIN_REDIRECT_URL变量中指定的URL .

知道我哪里错了吗?

django django-socialauth

3
推荐指数
1
解决办法
1585
查看次数

在iOS上使用Django-social-auth&tastypie登录

我正在为iOS应用程序使用tastypie构建一个API.

我可以正常处理正常的身份验证/授权,但在使用django-social-auth注册/登录/链接通过Tastypie时我有点困惑.

如果我想,例如喜欢使用django-social-auth和tastypie在iOS应用程序上验证或注册用户,我该怎么做呢?有什么建议?我是以错误的方式看待这个吗?

python api django django-socialauth ios

2
推荐指数
1
解决办法
1472
查看次数

django-social-auth注册额外步骤

我正在使用django-social-auth和自定义用户模型(django 1.5)以及所需的额外字段.我需要用户在保存模型之前填充这些字段.在后端授权成功之后,有没有办法"中断"django-social-auth,但是在创建新用户模型之前,为了显示要求帐户详细信息的表单?

提前致谢

django django-socialauth

2
推荐指数
1
解决办法
914
查看次数

Django社交认证,输出额外的价值

我正在尝试使用django social auth for linkedin作为我的用户登录.我想从用户帐户中获取额外的值.我已经提到了我的参数settings.py,

LINKEDIN_SCOPE = ['r_basicprofile', 'r_emailaddress','r_fullprofile']
Run Code Online (Sandbox Code Playgroud)

但我得到的回复只是用户的基本个人资料信息.我怎样才能获得所有提到的范围信息?

django django-socialauth

2
推荐指数
1
解决办法
917
查看次数

登录后django-social-auth重定向

谷歌登录后,我想重定向到我的页面。这就是我所做的

<a id="google-login" href="/login/google/?next=/static/index.html">Google</a>
Run Code Online (Sandbox Code Playgroud)

但是我仍然被重定向到

/accounts/profile
Run Code Online (Sandbox Code Playgroud)

如何使django socail auth将我重定向到我需要的页面?

这是我的django-social-auth配置:

SOCIAL_AUTH_PIPELINE = (
    'social.pipeline.social_auth.social_details',
    'social.pipeline.social_auth.social_uid',
    'social.pipeline.social_auth.auth_allowed',
    'social.pipeline.social_auth.social_user',
    'social.pipeline.user.get_username',
    'social.pipeline.mail.mail_validation',
    'social.pipeline.user.create_user',
    'social.pipeline.social_auth.associate_user',
    'social.pipeline.social_auth.load_extra_data',
    'social.pipeline.user.user_details'
)
Run Code Online (Sandbox Code Playgroud)

我尝试在顶部添加:

'myapp.views.redirect_to_such_and_such',
Run Code Online (Sandbox Code Playgroud)

没有工作。

同样,如何使django socail auth将我重定向到我需要的页面?

提前致谢。

杰尼亚

django django-socialauth

2
推荐指数
1
解决办法
2423
查看次数

与django-social-auth的Google登录错误

我创建了一个django项目,使用django-social-auth登录谷歌.

我按照文档在Google开发者控制台中使用"OAuth 2.0"创建了一个应用程序并添加了API

Gmail API, Google+ API,  Google+ Domains API and Google+ Hangouts API
Run Code Online (Sandbox Code Playgroud)

在凭证中,我已将AUTHORIZED REDIRECT URIS设置为我的生产服务器URL"mysite.com".

我使用"CLIENT ID"和"CLIENT SECRET"配置了django设置.此设置在我的本地服务器上完美运行,用户已创建,并且电子邮件与用户关联.

但是当我搬到生产服务器时,我得到了错误

"400. That’s an error. OpenID auth request contains an unregistered domain: mysite.com". 
Run Code Online (Sandbox Code Playgroud)

有没有其他人面临类似的问题?

django google-api django-socialauth oauth-2.0 google-oauth

2
推荐指数
1
解决办法
1167
查看次数

Facebook不会返回电子邮件Python社交身份验证

这是我的管道settings.py:

SOCIAL_AUTH_PIPELINE = (
    'social.pipeline.social_auth.social_details',
    'social.pipeline.social_auth.social_uid',
    'social.pipeline.social_auth.auth_allowed',
    'social.pipeline.social_auth.social_user',
    'social.pipeline.user.get_username',
    'accounts.pipeline.create_user',
    'accounts.pipeline.update_user_social_data',
    # 'social.pipeline.user.create_user',
    'social.pipeline.social_auth.associate_user',
    'social.pipeline.social_auth.load_extra_data',
    'social.pipeline.user.user_details',
)
Run Code Online (Sandbox Code Playgroud)

以及这一行:

SOCIAL_AUTH_FACEBOOK_SCOPE = ['email']
Run Code Online (Sandbox Code Playgroud)

我也尝试过这个:

FACEBOOK_EXTENDED_PERMISSIONS = ['email']
Run Code Online (Sandbox Code Playgroud)

在我的pipeline.py:

def create_user(strategy, details, user=None, *args, **kwargs):
    if user:
        return {
            'is_new': False
        }

    fields = dict((name, kwargs.get(name) or details.get(name))
                  for name in strategy.setting('USER_FIELDS',
                                               USER_FIELDS))

    if not fields:
        return

    if strategy.session_get('signup') == 'UserType1':
        user1 = UserType1.objects.create_user(username=fields.get('username'))
        user1.user_type = User.USERTYPE1
        user1.save()

        return {
            'is_new': True,
            'user': user1
        }

    elif strategy.session_get('signup') == 'UserType2': …
Run Code Online (Sandbox Code Playgroud)

python django facebook django-socialauth python-social-auth

2
推荐指数
1
解决办法
2353
查看次数

Django Social Auth:Google OAuth2 - 仅显示来自受限域列表的电子邮件

我在网站上有 Django Social Auth(pypi 包social-auth-app-django)与 Google OAuth2 一起使用。

当他们打开页面时,他们会被重定向到 Google 的 OAuth2 身份验证。这非常有效,如果他们尝试使用不在我的限制列表中的电子邮件地址登录,他们会收到 AuthForbidden 异常。我为此添加了一个陷阱,并向他们显示一个不允许他们登录此网站的页面。到目前为止一切都很好。

但是,我希望无效的电子邮件帐户根本不显示在 Google 身份验证页面的列表中。在使用带有参数的 javascript 之前,我已经通过手动调用身份验证页面来完成此操作,但我不确定如何使用罐装 Django 社交身份验证模块来执行此操作。

这可以做到吗?如果可以,怎么做?

我有中间件可以检测用户是否未登录并返回一个 login() 视图,该视图将用户重定向到 Google 身份验证页面。

视图.py

# Login using OAuth2.
@csrf_protect
def login(request):
    next_page = request.path
    if next_page is None or next_page == '':
        next_page = request.POST.get('next', request.GET.get('next', ''))

    # Check if they are already logged in and redirect them to the original page if so.
    if hasattr(request, 'user') and request.user.is_authenticated:
        return HttpResponseRedirect(next_page)

    # Otherwise, send them …
Run Code Online (Sandbox Code Playgroud)

django django-socialauth python-social-auth

2
推荐指数
1
解决办法
1354
查看次数

无法使用django-social-auth使用twitter登录

我正在使用django-social-auth app(https://github.com/omab/django-social-auth)进行社交认证.

我向应用程序提供了consumer_key和consumer_secret.

当我写入登录到Twitter
http://127.0.0.1:8000/accounts/login/twitter的链接时,页面加载,好像有一个请求被发送,持续几秒钟,然后页面停止加载,没有任何重定向或任何其他反应

django-socialauth twitter-oauth

1
推荐指数
1
解决办法
1211
查看次数

如何更改Django Social auth loggedin Twitter用户的密码

我正在使用social-auth以及userena和朋友应用程序.我想为twitter登录用户提供一个功能,使用django更改密码表单来更改他们的密码但是对于Twitter用户当前密码无法更改它所以请任何人都可以帮助我使用它提前感谢

python django django-socialauth

1
推荐指数
1
解决办法
1426
查看次数