omab / django-social-auth Goto Github PK
View Code? Open in Web Editor NEWDjango social authentication made simple
Home Page: https://groups.google.com/group/django-social-auth
License: BSD 3-Clause "New" or "Revised" License
Django social authentication made simple
Home Page: https://groups.google.com/group/django-social-auth
License: BSD 3-Clause "New" or "Revised" License
In backends.py, when the pre_update signal is used (in SocialAuthBackend.update_user_details), it sets sender=self. Any receiver that filters on the sender class, e.g. sender=TwitterBackend, will not receive the signal, even if the sender is the right type.
I ran a quick test by changing line 123 to have "sender=self.class", and now it works as expected.
I'm trying to use the example project, using OpenID.
Steps to reproduce:
python manage.py runserver <myip>:8000
if I return to "home" and try again a 2nd time, this time it works correctly, authenticates, and redirects to /accounts/profile.
After logging out, if I try to log in with the OpenID again, it again takes 2 tries -- the first with a CSRF failure.
I'm having trouble getting social_auth to play nicely with dumpdata/loaddata. It seems like the dumped extra_data string is badly formatted. Requoting the strings with double quotes ("...") rather than unicode and single quotes (u'.....') allows the fixture to be reloaded fine.
I have a feeling this is an issue with how extra_data is first set. After that it's just a text string which isn't parsed until the loaddata process happens (thus revealing the issue).
I'm using {% url begin backend='google-oauth' %} to create the UserSocialAuth instance.
<object pk="1" model="social_auth.usersocialauth">
<field to="auth.user" name="user" rel="ManyToOneRel">2</field>
<field type="CharField" name="provider">google-oauth</field>
<field type="CharField" name="uid">[email protected]</field>
<field type="TextField" name="extra_data">{u'access_token': u'oauth_token_secret=xxxxxxxxxxxx&oauth_token=yyyyyyyyyyyyyyy'}</field>
</object>
Problem installing fixture '/var/www/vhosts/Persist_20Apr/myproject/eta/fixtures/test_one_social.xml': Traceback (most recent call last):
File "/Users/oliver/venv-django12/lib/python2.6/site-packages/django/core/management/commands/loaddata.py", line 169, in handle
for obj in objects:
File "/Users/oliver/venv-django12/lib/python2.6/site-packages/django/core/serializers/xml_serializer.py", line 164, in next
return self._handle_object(node)
File "/Users/oliver/venv-django12/lib/python2.6/site-packages/django/core/serializers/xml_serializer.py", line 210, in _handle_object
value = field.to_python(getInnerText(field_node).strip())
File "/Users/oliver/venv-django12/src/social-auth/social_auth/fields.py", line 24, in to_python
raise ValidationError(str(e))
ValidationError: [u'Expecting property name: line 1 column 1 (char 1)']
Allow user to associate several social accounts to its user account.
I'm getting error "Cannot resolve keyword 'name' into field" when trying to use search in /admin/social_auth/usersocialauth/
I think problem is in row 10 in admin.py:
- search_fields = ('user__name',)
+ search_fields = ('user__first_name','user__last_name','user__email',)
Hi,
I have managed to setup Twitter login successfully, but not facebook login. First thing I would like to make sure is that app_secret
goes into FACEBOOK_API_SECRET
, shouldn't it be FACEBOOK_APP_SECRET
?
When I go to /login/facebook/
I get to this URL:
http://127.facebook.com/complete/facebook/?code=2.7gjnFwVRMo35_hf1ag8pIw__.3600.1297684800-1459809612|ceSaUDXhNNdyA-a6gNgJF_QxgJM
Chrome says it could not find the website 127.facebook.com
. Not sure why this happens. I'm testing this in my local dev server http://127.0.0.1:8000
and facebook's app Site URL
matches this one.
I'm not getting any traceback or anything else.
Thanks, Best regards
Miguel Araujo
Hi,
I just started using Django, so maybe I am missing something, but it looks to me like it currently is impossible to modify the session from within a pre_update handler, since the session nor the request are being provided with the signal.
What I want to do is create a very simple listener that stores the login-backend (class/method) in the session, so I can show in my view how the user has authenticated himself. It seems to me the session object is the place to store this kind of information, but since there is no request object in the Signal, my listener cannot get to the session object for this request. Another option would be to store this in the user-profile, in the database, and resave it everytime you login but that does not make much sense if you ask me.
Am I missing something, or would it be an idea to add the request to the Signal providing_args?
Hola Matías,
I have been thinking on how the app controls transactions, I reckon that maybe SocialAuthBackend.authenticate
should be wrapped in a @transaction.commit_on_success
so that no User
gets created without a UserSocialAuth
match, avoiding inconsistent data in the application.
What do you think?
Best regards,
Miguel Araujo
Hi,
Today i tried to use django-social-auth and authorization through Orkut, and i find that orkut oauth does not work, because Orkut algorithm was slighty changed . I modified orkut.py to get it worked.:
"""
Orkut OAuth support.
This contribution adds support for Orkut OAuth service. The scope is
limited to http://orkut.gmodules.com/social/ by default, but can be
extended with ORKUT_EXTRA_SCOPE on project settings. Also name, display
name and emails are the default requested user data, but extra values
can be specified by defining ORKUT_EXTRA_DATA setting.
OAuth settings ORKUT_CONSUMER_KEY and ORKUT_CONSUMER_SECRET are needed
to enable this service support.
"""
import urllib
from django.conf import settings
from django.utils import simplejson
from social_auth.backends import OAuthBackend, USERNAME
from social_auth.backends.google import BaseGoogleOAuth
# Orkut configuration
# default scope, specify extra scope in settings as in:
# ORKUT_EXTRA_SCOPE = ['...']
ORKUT_SCOPE = ['http://orkut.gmodules.com/social/']
ORKUT_REST_ENDPOINT = 'http://www.orkut.com/social/rpc'
ORKUT_DEFAULT_DATA = 'name,displayName,emails'
class OrkutBackend(OAuthBackend):
"""Orkut OAuth authentication backend"""
name = 'orkut'
def get_user_details(self, response):
"""Return user details from Orkut account"""
return {USERNAME: response['displayName'],
'email': '',
'fullname': response['displayName'],
'first_name': response['name']['givenName'],
'last_name': response['name']['familyName']}
class OrkutAuth(BaseGoogleOAuth):
"""Orkut OAuth authentication mechanism"""
AUTH_BACKEND = OrkutBackend
SETTINGS_KEY_NAME = 'ORKUT_CONSUMER_KEY'
SETTINGS_SECRET_NAME = 'ORKUT_CONSUMER_SECRET'
def user_data(self, access_token):
"""Loads user data from Orkut service"""
fields = ORKUT_DEFAULT_DATA
if hasattr(settings, 'ORKUT_EXTRA_DATA'):
fields += ',' + settings.ORKUT_EXTRA_DATA
scope = ORKUT_SCOPE + getattr(settings, 'ORKUT_EXTRA_SCOPE', [])
params = {'method': 'people.get',
'id': 'myself',
'userId': '@me',
'groupId': '@self',
'fields': fields,
'scope': ' '.join(scope)}
request = self.oauth_request(access_token, ORKUT_REST_ENDPOINT, params)
response = urllib.urlopen(request.to_url()).read()
try:
return simplejson.loads(response)['data']
except (ValueError, KeyError):
return None
def oauth_request(self, token, url, extra_params=None):
extra_params = extra_params or {}
scope = ORKUT_SCOPE + \
getattr(settings, 'ORKUT_EXTRA_SCOPE', [])
extra_params.update({
'scope': ' '.join(scope),
})
return super(OrkutAuth, self).oauth_request(token, url, extra_params)
# Backend definition
BACKENDS = {
'orkut': OrkutAuth,
}
Page url: accounts/complete/facebook/?code=2.3KFEwT7QTszcH1OwNcqiUw__.3600.1301616000-100002218811672|s0T9ZdXlG2Sr6GM2mihD************
Django Version: 1.3
Exception Type: TypeError
Exception Value:
argument of type 'bool' is not iterable
Exception Location: /Volumes/duccio/Sites/django/met_env/lib/python2.6/site-packages/social_auth/backends/facebook.py in auth_complete, line 71
Thanks.
====update 2 ====
My mistake in setting up the app url at the facebook setup page. My deployment works. Thanks.
However, the demo hosted at http://social.matiasaguirre.net/ fails to achieve simultaneous login, as mentioned in update 1.
====update 1 ====
omab, I tried changing the call back to the root url of my site at the facebook app setup page, but the same error.
Even the demo hosted at : http://social.matiasaguirre.net/ fails to achieve simultaneous login.
Try:
====original issue====
Steps to reproduce the problem:
The reason is simple, there is only one callback url allowed at facebook app settings.
Should, in the case of simultaneous login, it be redirected to /complete/facebook/ only and then internally be redirected to /associate/complete/facebook/
Am I missing something?
I noticed your forwarding newly registered users to the same page as loged in users. LOGIN_REDIRECT_URL
Is there an easy to way to display a completion page when creating a new user?
Is there a special scope I need to define to get the users first and last name?
Would anyone be interested in a version of django-social-auth that uses SimpleGeo's oauth2 library (it's actively maintained)? I have a fork that uses this instead of python-oauth as I'm generally wary of projects that haven't been updated for months.
It's a fairly big "patch" as oauth2's interface is a bit different so I figured to first check if anyone's actually interested.
Thank you all for coming up with this wonderful app. It's really cool! However, please allow me to post a question here, since I don't know a better place to shoot this question.
I am using django-social-auth with my authentication mechanism of my application. In other parts of my app, I need the email from the logged-in user for certain features. I do not have any problem with Google and Yahoo. However, when it comes to facebook, I could not gain the user email from reques.user. Could you please tell me where I will be able to get the user email?
Here comes my code to get the user info. Thank you very much.
''' Gets the basic user information from the system. ''' def getDjangoDefaultUserInfo(request): email = '' provider = None user_name = request.user.username provider_string = '' if user_name != '': email = request.user.email provider = request.user.social_auth.values_list('provider', flat=True) for name in provider: provider_string += name.lower().replace('-', '_') info = { 'user_name' : user_name, 'email' : email, 'provider' : provider_string } return info
should be storing the facebook token expires value somewhere, might as well be in extra data. Might as make this something easy to parse and store it as a json string
Simplify URLs definition using a single type, in this case, remove URLs names support:
SOCIAL_AUTH_COMPLETE_URL_NAME
SOCIAL_AUTH_ASSOCIATE_URL_NAME
with fixed versions like django auth contrib application does.
Hi,
i think that UUID_MAX_LENGTH must be editable in settings.py.
What you think?
Thanks in advance.
Regards.
Hi guys, i receive thi exception after authorize Twitter.
ImproperlyConfigured at /complete/twitter/
Module "social_auth.backends" does not define a "TwitterBackend" authentication backend
Request Method: GET
Request URL: http://127.0.0.1:8000/complete/twitter/?oauth_token=70UCpQwSdsG3HaFBjxd25JgBKWkLVuWVKz7JkLM&oauth_verifier=bJySFkb2GsPQna2J935Yq4fw1SdEMBJCbqn7t2v7ABQ
Django Version: 1.2.4
Exception Type: ImproperlyConfigured
Exception Value:
Module "social_auth.backends" does not define a "TwitterBackend" authentication backend
Exception Location: /Volumes/duccio/Sites/django/django_metwit/lib/python2.6/site-packages/django/contrib/auth/init.py in load_backend, line 22
Python Executable: /Volumes/duccio/Sites/django/django_metwit/bin/python
Python Version: 2.6.1
Python Path: ['/Volumes/duccio/Sites/django/play', '/Volumes/duccio/Sites/django/django_metwit/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg', '/Volumes/duccio/Sites/django/django_metwit/lib/python2.6/site-packages/pip-0.8.1-py2.6.egg', '/Volumes/duccio/Sites/django/django_metwit/src/urlencoding', '/Volumes/duccio/Sites/django/django_metwit/lib/python26.zip', '/Volumes/duccio/Sites/django/django_metwit/lib/python2.6', '/Volumes/duccio/Sites/django/django_metwit/lib/python2.6/plat-darwin', '/Volumes/duccio/Sites/django/django_metwit/lib/python2.6/plat-mac', '/Volumes/duccio/Sites/django/django_metwit/lib/python2.6/plat-mac/lib-scriptpackages', '/Volumes/duccio/Sites/django/django_metwit/Extras/lib/python', '/Volumes/duccio/Sites/django/django_metwit/lib/python2.6/lib-tk', '/Volumes/duccio/Sites/django/django_metwit/lib/python2.6/lib-old', '/Volumes/duccio/Sites/django/django_metwit/lib/python2.6/lib-dynload', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-tk', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac/lib-scriptpackages', '/Volumes/duccio/Sites/django/django_metwit/lib/python2.6/site-packages']
Server time: Wed, 23 Feb 2011 18:51:01 -0600
Is it possible to implement?
There are 2 import problems:
I fixed both problems:
"""
Linkedin OAuth support
No extra configurations are needed to make this work.
"""
from xml.etree import ElementTree
import xml.parsers.expat as expat
try:
from urlparse import parse_qs
except ImportError:
# fall back for Python 2.5
from cgi import parse_qs
from social_auth.backends import ConsumerBasedOAuth, OAuthBackend
LINKEDIN_SERVER = 'linkedin.com'
LINKEDIN_REQUEST_TOKEN_URL = 'https://api.%s/uas/oauth/requestToken' % \
LINKEDIN_SERVER
LINKEDIN_ACCESS_TOKEN_URL = 'https://api.%s/uas/oauth/accessToken' % \
LINKEDIN_SERVER
LINKEDIN_AUTHORIZATION_URL = 'https://www.%s/uas/oauth/authenticate' % \
LINKEDIN_SERVER
LINKEDIN_CHECK_AUTH = 'https://api.%s/v1/people/~' % LINKEDIN_SERVER
class LinkedinBackend(OAuthBackend):
"""Linkedin OAuth authentication backend"""
name = 'linkedin'
def get_user_details(self, response):
"""Return user details from Linkedin account"""
return {
'first_name': response['first-name'],
'last_name': response['last-name'],
'email': '', # not supplied
}
class LinkedinAuth(ConsumerBasedOAuth):
"""Linkedin OAuth authentication mechanism"""
AUTHORIZATION_URL = LINKEDIN_AUTHORIZATION_URL
REQUEST_TOKEN_URL = LINKEDIN_REQUEST_TOKEN_URL
ACCESS_TOKEN_URL = LINKEDIN_ACCESS_TOKEN_URL
SERVER_URL = 'api.%s' % LINKEDIN_SERVER
AUTH_BACKEND = LinkedinBackend
SETTINGS_KEY_NAME = 'LINKEDIN_CONSUMER_KEY'
SETTINGS_SECRET_NAME = 'LINKEDIN_CONSUMER_SECRET'
def user_data(self, access_token):
"""Return user data provided"""
request = self.oauth_request(access_token, LINKEDIN_CHECK_AUTH)
raw_xml = self.fetch_response(request)
try:
xml = ElementTree.fromstring(raw_xml)
data = _xml_to_dict(xml)
url = data['site-standard-profile-request']['url']
url = url.replace('&', '&')
data['id'] = parse_qs(url)['key'][0]
return data
except (expat.ExpatError, KeyError, IndexError):
return None
@classmethod
def enabled(cls):
return True
def _xml_to_dict(xml):
"""Convert xml structure to dict"""
data = {}
for child in xml.getchildren():
if child.getchildren():
data[child.tag] = _xml_to_dict(child)
else:
data[child.tag] = child.text
return data
# Backend definition
BACKENDS = {
'linkedin': LinkedinAuth,
}
Should be
SOCIAL_AUTH_ASSOCIATE_URL_NAME = 'namespace:associate_complete'
and not
SOCIAL_AUTH_ASSOCIATE_URL_NAME = 'namespace:association_complete'
Hi! Can anybody help me? When I try to log in via Facebook account I get an error:
{
"error": {
"type": "OAuthException",
"message": "Invalid redirect_uri: \u0414\u0430\u043d\u043d\u044b\u0439 URL \u043d\u0435 \u0434\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0435\u0439 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f."
}
}
Django Version: 1.3
My URL looks like: https://graph.facebook.com/oauth/authorize?redirect_uri=http%3A%2F%2F127.0.0.1%3A8000%2Fcomplete%2Ffacebook%2F&client_id=MY_APP_ID_15_digits
Probably I get this error cuz I run my application on development server with URL 127.0.0.1? I dont know why, I have set URL on my application settings on Facebook http://mytestapp123.com/ and added it to file hosts.
Currently custom User class is kinda hackish, needs improvement.
Hi guys,
i'm trying to understand if an user loggend, can associate its account with social account like twitter, facebook or google.
I think that the url is:
/associate/backend>/
but maybe I'm wrong because i receive some error, like this:
NoReverseMatch: Reverse for 'association_complete' with arguments '(u'google',)' and keyword arguments '{}' not found.
Thanks in advance.
Hi,
This not a issue but an open question : what is the reason for not retrieving a user account when found via the email field instead of creating a new one with the same email ?
For example : I already have a user account with the email "[email protected]" and when this user tries to connect with his facebook account (which shares the same mail) in a not-logged context, django-social-auth creates a duplicate entry with the same mail "[email protected]".
I know there is a associate view which only works in a logged context and the fact that django email field is a non-unique field but sometime user wants to authenticate with their email address.
Thank you for your answer and for your great work ;)
Please replace get_db_prep_save to get_prep_save in JSONField
See http://docs.djangoproject.com/en/1.3/releases/1.2/#get-db-prep-methods-on-field
If an user login using different services (Google, Twitter, etc) and the user has the same username for at least two, Django raises an IntegrityError exception because it try to create more than one django account with the same username.
I pasted a debug page example below:
Environment:
Request Method: GET
Request URL: http://www.erwinfeser.com.ar/...
Django Version: 1.2.3
Python Version: 2.6.5
Installed Applications:
['tinymce',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.admin',
'feserwin.erwinsite',
'feserwin.teg7',
'social_auth']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.middleware.csrf.CsrfResponseMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware')
Traceback:
File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py" in get_response
response = callback(request, _callback_args, *_callback_kwargs)
user = backend.auth_complete()
return authenticate(_args, *_kwargs)
user = backend.authenticate(**credentials)
self.update_user_details(user, response, details, new_user=new_user)
user.save()
self.save_base(using=using, force_insert=force_insert, force_update=force_update)
rows = manager.using(using).filter(pk=pk_val)._update(values)
return query.get_compiler(self.db).execute_sql(None)
cursor = super(SQLUpdateCompiler, self).execute_sql(result_type)
cursor.execute(sql, params)
return self.cursor.execute(sql, params)
return self.cursor.execute(query, args)
self.errorhandler(self, exc, value)
raise errorclass, errorvalue
Exception Type: IntegrityError at /site/social-auth/complete/google/
Exception Value: (1062, "Duplicate entry 'ErwinFeser' for key 'username'")
Hola Matías,
I've thought that maybe we could add another signal to the app. This one would be fired only once per new UserSocialAuth created. Let me explain you a use case. Imagine you need to attach a User profile and some other model to your new social user created, you only need to handle that once. I'm right now connecting to a post_save
signal but first, the signal is fired twice within authenticate
. Second time when User
data is updated.
Every time the user logs, User
data is updated and the signal is fired and enters my handler, which is unnecessary.
Maybe creating a socialuser_registered
signal that is fired after updating the user data and only once per new user creation would be nice.
What do you think?
Best regards,
Miguel Araujo
Accompanying the documentation in PyPI, I realized the import of calling the signals pre_save on signals.py was incorrect in the file within the social-auth, I suggest upgrading pre_save to pre_update in PyPI documentation or change the files again using the pre_update to pre_save.
http://pypi.python.org/pypi/django-social-auth/0.1.2
https://github.com/omab/django-social-auth/blob/master/social_auth/signals.py
Sorry for my bad English =)
Hi, you have done a great job with this plugin.
Currently i have developed a facebook+django app, when you try to access via the normal URL works fine redirecting the user if is not logged into facebook, but when you put the app inside an iframe it shows an extra step that make users thing "this is a bug".
Seems like is a Facebook protection or something, but how we can make this not appear as a bug?
Try not to be logged in facebook and access both apps in the button "login" and you see in the iframe version an extra step not showing in the external version.
This is the extra step that looks as a bug: http://cl.ly/6TmN
Thanks for your comments,
https://github.com/simplegeo/python-oauth2
Which is more active and has test coverage
How can I set session expiration on a case-by-case basis? Sometimes I want session to use the default value, and sometimes I specifically only want session to live for existing browser window.
Hola Matías,
It is a common trend among most popular django-apps to move Sphinx docs to http://readthedocs.org/ which is a very nice project by @ericholscher. You might be interested in doing so.
Best regards,
Miguel Araujo
If service (tested on myopenid.com) returns an empty username it should be changed to default or random.
Basically, in social_auth/backends/init.py, method "username", line 136 additional check for an empty value of username should be done, if it is so - either default or random name should be used.
Hi guys.
How i can implement the foursquare support for django-social-auth?
It use OAuth 2.0: https://developer.foursquare.com/docs/
Thanks in advance.
Hi again,
I need to know when a user is created by the authenticate method of the SocialAuthBackend.
Use case: when a user is automatically created by django-social-auth, I write a specific message (with the help of the messages framework) which can be only done in a request context.
I know there is a signal named socialauth_registered which is launched when a user is created but for the need of my application I have to interact with the request object.
When I look into the authenticate method of the SocialAuthBackend I find the is_new variable which is True when a user is created.
Is there any way to return this value in the authenticate process?
I also have a quick solution based on django.contrib.auth.backends.authenticate which can be done in l.150 of social_auth/backends/init.py:
user.is_new = is_new
return user
Thanks again.
Hello
You use deprecate functions in backends.py:
import os
-import md5
+from hashlib import md5
from openid.extensions import ax, sreg
from django.conf import settings
@@ -66,7 +66,7 @@
"""
def get_random_username():
"""Return hash from random string cut at 30 chars"""
return md5.md5(str(os.urandom(10))).hexdigest()[:30]
return md5(str(os.urandom(10))).hexdigest()[:30]
if getattr(settings, 'SOCIAL_AUTH_FORCE_RANDOM_USERNAME', False):
username = get_random_username()
And change please in how to names backends:
from:
AUTHENTICATION_BACKENDS = (
'social_auth.backends.TwitterOAuthBackend',
'social_auth.backends.FacebookOAuthBackend',
'social_auth.backends.OrkutOAuthBackend',
'social_auth.backends.GoogleOpenIDBackend',
'social_auth.backends.YahooOpenIDBackend',
'social_auth.backends.OpenIDBackend',
'django.contrib.auth.backends.ModelBackend',
)
To:
AUTHENTICATION_BACKENDS = (
'social_auth.backends.TwitterBackend',
'social_auth.backends.FacebookBackend',
'social_auth.backends.GoogleBackend',
'social_auth.backends.OpenIDBackend',
'django.contrib.auth.backends.ModelBackend',
)
Thank You for library :)
Improve backends by adding a contrib like structure where modules will be loaded dynamically and contributions will be easier to maintain.
Hi
when I click on facebook login from the base template page
I get the following error
Exception Type: IOError at /complete/facebook/
Exception Value: [Errno url error] unknown url type: 'https'
EDIT : As I was working on localhost, I needed to deploy it !
But I stil get an error when I want to login facebook, it ends up on this page
http://zotcybercase.appspot.com/complete/facebook/?code=4ed2e9d1bf9a6be021188a19-527970475|HEsr146zwnUMImudQXVLYT6TrU8
with "There was an error while handling your request."
EDIT 2 : I'm such a dumba**, the facebook secret key was not good, I put the api key
May it serve some people...
Let me continue (I can't find the delete button for that useless post...)
In the django ADMIN whenever I click on "Associations", "Nonces", "Users social auths" under "Social_Auth"...it raise an error 500
my GAE logs says :
File "/base/python_runtime/python_lib/versions/1/google/appengine/datastore/datastore_query.py", line 1013, in __query_result_hook
str(exc) + '\nThis query needs this index:\n' + yaml)
NeedIndexError: no matching index found.
This query needs this index:
What does that mean ?
auth_process()
overwrites the current session[REDIRECT_FIELD_NAME]
, making it impossible to set the url to redirect to after logging in in a page-specific manner (visiting a certain login page redirects to one page, while visiting another login page redirects to another).
Feel free to correct me if I'm wrong, and delete this issue.
The LICENSE file included is clearly a BSD license, but setup.py (and consequently PyPI) state that the software is licensed under the GPL. The setup.py file should be corrected.
this code fragment is not thread safe (backends/init.py):
name, idx = username, 2
while True:
try:
name = fixer(name)
User.objects.get(username=name)
name = username + str(idx)
idx += 1
except User.DoesNotExist:
username = name
break
parallel processes or threads can generate same username and try to store same usernames. but the only one thread will write data, and others will raise IntegrityError.
using uuid instead of incrementing index is more safe. you can generate uuid and store it in base36.
greetz.
Example: first time I login by manually enter OpenId with OpenIDBackend, second time I login with LiveJournalBackend.
According to the below code, I get two account with the same OpenId identity_url.
# backends/__init__.py
try:
social_user = UserSocialAuth.objects.select_related('user')\
.get(provider=self.name,
uid=uid)
except UserSocialAuth.DoesNotExist:
# ...
I try to fix this by test isinstance(backend, OpenIDBackend)
, but stop at
# views.py
social_user = user.social_auth.filter(provider=backend_name) \
.order_by('-id')[0]
And if use this way to fix this bug will make codes not clear. May be there has a better way, but I have no.
My first time use github, and my English not well, so please...
Thanks very much.
Kinpoo
Hola Matías,
I haven't found any tests within you app's directories. I'm not sure why there are not any tests, is it because testing it would be quite hard? I think for ensuring app's quality we should work at least on some login and association tests for every backend supported.
What do you think? any ideas on this?
Best regards,
Miguel Araujo
Twitter integration is giving the following error:
KeyError at /login/twitter/
oauth_token
(facebook works fine)
This would be for at least Facebook - however, nothing meaningful is done with the expiration data.
I think this code needs to be looked at. I'm having really weird issues when users don't have emails.
Try creating a linkedin.... logout... then login with a twitter. When it does the finally redirect you will have the details from the previous linkedin account
Hi,
I just tried to implement social_auth, and I'm running into trouble with whitespace in the username that's created. I have a UserProfile model that's linked by ForeignKey to a User. When I want to see a UserProfile I go to /profile/username
The SocialAuthBackend creates a username based on details, as pasted in the code below:
if FORCE_RANDOM_USERNAME:
username = get_random_username()
elif USERNAME in details:
username = details[USERNAME]
elif DEFAULT_USERNAME:
username = DEFAULT_USERNAME
if callable(username):
username = username()
In "details" my Facebook username, apparently, is "Firstname Lastname," like "Joe Smith." So there is a whitespace in between "joe" and "smith." This is unallowed, as is written in the "Username" form field in the Change user admin template: "Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only."
How shall I fix this?
Thanks!
Facebook login is not working on Firefox 3.6 (MacOSx)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.