草庐IT

social-authentication

全部标签

python - django request.user.is_authenticated 总是正确的吗?

谁能告诉我为什么在下面的代码中我被重定向到yahoo.com而不是google.com?网址urlpatterns=patterns('',(r'^$',initialRequest,))查看definitialRequest(request):ifrequest.user.is_authenticated:returnHttpResponseRedirect('http://yahoo.com')else:returnHttpResponseRedirect('http://google.com') 最佳答案 不应该是reques

python - 如何使用 Python-Social-auth 和 Django 检索 Facebook 好友的信息

如何使用Python-Social-auth和Django检索Facebook好友的信息?我已经检索了个人资料信息并对用户进行了身份验证,但我想获取有关他们friend的更多信息并邀请他们使用我的应用程序。谢谢! 最佳答案 您可以使用FacebookAPI来完成。首先,您需要获取您的Facebook应用程序的token(FACEBOOK_APP_ACCESS_TOKEN)https://developers.facebook.com/tools/accesstoken/或来自social_user.extra_data['acces

python - 类型错误 : 'bool' object is not callable g. user.is_authenticated()

这个问题在这里已经有了答案:Flask-LoginraisesTypeError:'bool'objectisnotcallablewhentryingtooverrideis_activeproperty(2个答案)关闭7年前。我正在尝试在我的Flask应用程序中执行此操作。但是我收到这样的错误TypeError:'bool'objectisnotcallable.对应的代码如下:@app.before_requestdefbefore_request():g.user=current_userifg.user.is_authenticated():g.search_form=Non

python - 如何使用 Django Social Auth 连接 Twitter?

我正在尝试使用DjangoSocialAuth包连接到Twitter,但我很难理解如何做到这一点,因为我找不到任何例子。我假设DjangoSocialAuth是用于此目的的最佳包。我查看了一些使用Facebook的示例,并将以下内容添加到我的settings.py文件中:AUTHENTICATION_BACKENDS=('social_auth.backends.twitter.TwitterBackend','django.contrib.auth.backends.ModelBackend',)#overwritingdefaulttemplatesTEMPLATE_CONTEXT

python - 使用python-social-auth的django社交身份验证错误

我正在关注这个answer这非常清楚和有帮助,我已经配置了所有设置,但是在使用gmail登录后,我被重定向到localhost:8000/soc/complete/google-oauth2/?state=jAwzw....我收到这个错误HTTPErrorat/soc/complete/google-oauth2/403ClientError:Forbiddenforurl:https://www.googleapis.com/plus/v1/people/me?access_token=ya29..wwKoNcTfjGshqc8UYfdziBbgVtYP4bgBZ9ehrfsHJjf

python - Flask-Login 中使用的 "is_authenticated"方法有什么意义?

我正在学习FlaskMega-Tutorial,我遇到了这段代码:classUser(db.Model):id=db.Column(db.Integer,primary_key=True)nickname=db.Column(db.String(64),unique=True)email=db.Column(db.String(120),unique=True)role=db.Column(db.SmallInteger,default=ROLE_USER)posts=db.relationship('Post',backref='author',lazy='dynamic')defi

python - is_authenticated() 引发 TypeError TypeError : 'bool' object is not callable

这个问题在这里已经有了答案:Flask-LoginraisesTypeError:'bool'objectisnotcallablewhentryingtooverrideis_activeproperty(2个答案)关闭7年前。我尝试在View中使用is_authenticated(),但收到错误“TypeError:'bool'objectisnotcallable”。为什么会出现此错误以及如何解决?@auth.before_app_requestdefbefore_request():ifcurrent_user.is_authenticated()\andnotcurrent_

python - Django Tastypie : How to Authenticate with API Key

我正在使用TastyPie制作一个内部API。我有fromtastypie.authenticationimportApiKeyAuthenticationclassMyResource(ModelResource):Meta:authentication=ApiKeyAuthentication()在禁用身份验证规则的情况下,我的API运行良好。启用它后,无论我尝试什么,我都会收到401(未经授权)响应。我敢肯定,一旦您看到它的实际效果,这是非常明显的事情之一,但与此同时,请告知如何发出请求(GET)。 最佳答案 将用户名和api

html - 为什么 Rails 给我 "Can' t verify CSRF token authenticity”错误?

我在Rails生产中收到“无法验证CSRFtoken真实性”。我的问题是:为什么要这样做?我该如何解决?这是我的Heroku日志(一些值已匿名):2016-02-13T01:18:54.118956+00:00heroku[router]:at=infomethod=POSTpath="/login"host=[MYURL]request_id=[IDSTRING]fwd="FWDIP"dyno=web.1connect=0msservice=6msstatus=422bytes=17832016-02-13T01:18:54.116581+00:00app[web.1]:Starte

authentication - 如何用HTML或JAVASCRIPT制作登录认证页面

我是电子学出身,所以不太懂网页设计。我正在做一个以太网项目,为此我需要制作一个网页,但在该网页之前我还需要制作一个登录身份验证网页。我以某种方式设法使用HTMLJAVASCRIPT做到了,但问题是任何人都可以通过查看页面源代码来查看用户名密码。我很难进行身份验证。我有HTML和JAVASCRIPT的基本知识,但准备学习。我在谷歌上只能找到登录模板,但我什至不知道如何使用它们。任何人都可以给我一个例子或给我一些好的链接。 最佳答案 HTML和Javascript在clientside上被解释。出于登录目的,服务器端代码通常用于验证凭据