Menu
  • HOME
  • TAGS

Python-Social-Auth shows 'AuthStateForbidden' sometimes

python,django,python-social-auth

I had this issue for several times too. From the documentation we know that: AuthStateForbidden - The state parameter returned by the server is not the one sent class AuthStateForbidden(AuthException): """State parameter is incorrect.""" def __str__(self): return 'Wrong state parameter given.' I have searched for any kind of the solution...

Python Social Auth, Extending Disconnect Pipeline

python,django,python-social-auth

Try this SOCIAL_AUTH_DISCONNECT_PIPELINE = ( 'social.pipeline.disconnect.allowed_to_disconnect', 'social.pipeline.disconnect.get_entries', 'social.pipeline.disconnect.revoke_tokens', # 'social.pipeline.disconnect.disconnect', # comment 'profiles.utils.custom_pipeline', ) custom_pipeline.py def disconnect(strategy, entries, user_storage, *args, **kwargs): for entry in entries: user_storage.disconnect(entry) backend = kwargs.get('name') profile=Profiles.objects.get(user=entries[0].user) if backend == 'facebook': profile.fb_id = ''...

How do I assign Instagram redirect uri in python social auth? [duplicate]

oauth,python-social-auth

As was suggested by @Wolph it is better to change the redirect uri within my instagram developer account to match the endpoint of python social auth. So, http://localhost:8000/complete/instagram helped....

oauth2 token authentication using django-oauth-toolkit and python-social-auth

django,oauth-2.0,django-rest-framework,python-social-auth

I've done something very similar to this before with other OAuth plugins for Django REST Framework, and it should be relatively easily once you understand how the authentication flow has to work. However, the following doesn't work since there is no corresponding authentication scheme for Django REST Framework and the...

Python-social-auth: disable autoregistering new users

django,facebook,python-social-auth

As omab pointed out, working code is 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.social_auth.associate_user', 'social.pipeline.social_auth.load_extra_data', 'social.pipeline.user.user_details' )` ...

Create Custom Registration Pipeline Using python-social-auth

django,authentication,python-social-auth

You can keep your pipeline that flags the user as disabled, but also define this setting SOCIAL_AUTH_INACTIVE_USER_URL = "/wait-for-activation" (point it to the URL that shows the "wait for activation" page).

Python Social Auth: How to define a different username scheme?

python,django,django-socialauth,python-social-auth

All you need is to replace social.pipeline.user.get_username from SOCIAL_AUTH_PIPELINE with path to your own function returning generated username. For example: project/myapp/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', 'project.myapp.utils.get_username', 'social.pipeline.social_auth.associate_by_email', 'social.pipeline.user.create_user',...

python social auth load strategy and authenticate user manually with release 0.1.26

python-social-auth

The last changes in the repository changed the importance of the strategy, instead of being the main entity to perform the authentication, it's just a helper class to glue the framework with the backends. Try with this snippet to load the strategy and the backend: from social.apps.django_app.utils import load_strategy, load_backend...

Accessing user's current company with django social-auth

django,linkedin,django-socialauth,python-social-auth

Figured it out. After you've retrieved the dictionary "details" from linked in, you can retrieve current companies with: current_companies = [position['company']['name'] for position in details['positions']['position'] if position['is-current']=='true'] ...

How do I save user-info in a custom user model?

django,facebook,python-social-auth

I figured it out, since i was using python3 i should of used list() on my dict values like so: attrs = dict(list(attrs.items()) + list(fb_data.items())) Also instead of saving the image in the database it was best just to save the url, saving alot of space...

Python-social-auth get user city

django,python-social-auth

Add the user_location scope to the SOCIAL_AUTH_FACEBOOK_SCOPE setting Get the location by doing response['location'] in a pipeline (users that didn't fill their location in their profile won't have that key, so check for it first) ...

python-social-auth and github, I have this error “The redirect_uri MUST match the registered callback URL for this application”

python,django,github,python-social-auth

This library uses OAuth for GitHub authentication. You must provide a callback URL, because the OAuth process causes the user's browser to actually leave your site as part of the authentication process. The callback URL that you send to GitHub is used to redirect users back to your site. It...

Filtering or restricting Google-Oauth2 login to a set of users in Django using Python Social Auth

python,regex,django,google-oauth,python-social-auth

You need a pipeline function for that, something simple as this should do the trick: from social.exceptions import AuthForbidden def email_check(strategy, details, *args, **kwargs): if not is_valid_email(details.get(email)): raise AuthForbidden(strategy.backend) Then stick this function after 'social.pipeline.social_auth.auth_allowed', entry, like this: SOCIAL_AUTH_PIPELINE = ( 'social.pipeline.social_auth.social_details', 'social.pipeline.social_auth.social_uid', 'social.pipeline.social_auth.auth_allowed', 'import.path.to.email_check',...

Cannot set custom parameter with python social auth

python,django,python-social-auth

I've figured out myself. Just add the following line to settings.py: SOCIAL_AUTH_FIELDS_STORED_IN_SESSION = ('tgtid', ) ...

Django REST Framework and python-social-auth for registration/login user

python,django,rest,django-rest-framework,python-social-auth

If it's not too late then why not use https://github.com/pennersr/django-allauth and https://github.com/Tivix/django-rest-auth which are designed to work together and simplify API based (social)login / logout / password reset token / password reset from token etc flows.

Problems getting jobs and education on Linkedin with Django (Python Social Auth)

django,linkedin,python-social-auth,linkedin-jsapi

Access to r_fullprofile requires that you apply for and are granted access to this information from LinkedIn. These profile fields are only available to applications that have applied and been approved for the Apply with LinkedIn use case. Member profile fields The following selection of profile fields are available to...

Facebook and linkedin not filling email field properly

python-social-auth

Found this in the docs silly of me not to realize that they would have different request parameters: http://psa.matiasaguirre.net/docs/backends/index.html

SQLAlchemy: How can I define a relationship as the union of two other relationships?

sqlalchemy,python-social-auth

Using zzzeek's solution linked above, I created a self-referential M2M relationship by using a select statement as the "secondary" argument to relationship(). friendship_union = select([ FacebookFriendship.dater_id, cast(FacebookFriendship.fb_uid_friend, Integer()).label( 'fb_uid_friend') ]).union( select([ cast(FacebookFriendship.fb_uid_friend, Integer()), FacebookFriendship.dater_id] ) ).alias() cls.all_fb_friendships = relationship( UserSocialAuth, secondary=friendship_union, primaryjoin=UserSocialAuth.user_id ==...

Pythons Social Auth for Spotify: redirect is missing 'state' parameter

python,django,oauth-2.0,spotify,python-social-auth

I've read through relevant parts of PSA's source code but I do not understand how this 'state' parameter gets passed around between Spotify and the app. When using the Authorization Code flow or Implicit Grant flow in oAuth 2.0, an optional state value can be appended to the authorize...

What is the difference between django-social-auth and python-social-auth?

django,django-socialauth,python-social-auth

django-social-auth has been deprecated in favor of python-social-auth. It even says this in the django-social-auth README. python-social-auth was built using django-social-auth as a foundation. The main advantage/difference is that it now supports multiple frameworks....

python-social-auth not getting correct Google OAuth2 details

django,python-2.7,django-socialauth,google-login,python-social-auth

I finally figured it out myself. According to this article in the Android's Google Plus documentation, I also need to request the plus.profile.emails.read scope when making the request in the Android app. Once I added this, the python-social-auth code managed to store the email properly in the uid fields. This...

Login vs Register in PythonSocialAuth

django,authentication,python-social-auth

Thanks for comments and suggestions. I realized how to resolve my problem, and this is my solution, hope it helps to others. The first problem is that PSA uses the same pipeline for both: registering new users and login existing ones. So, it's mandatory differentiate one pipeline flow form the...

400 Client Error: Bad Request using python-social-auth for Facebook auth in Django

django,facebook,facebook-oauth,python-social-auth

This bug was described as Issue #190 on the python-social-auth Github page. Please see this thread for possible workarounds.

Multiple pipelines in python social auth

django,python-2.7,python-social-auth

While it is not possible to have 2 different pipelines, you can certainly make use of the capabilities to extend the pipeline to consider both the "log in" and "registration" scenarios. After the default pipeline function social.pipeline.social_auth.social_user, all subsequent functions have access to the is_new parameter, which is False if...

Open New Window for Social Login and then Close and Return to Parent On Success with Django

javascript,python,django,twitter-bootstrap,python-social-auth

You solved the opening-in-a-popup part already, the closing is the tricky one, for that you need to serve some page with the needed JS code to close the popup and then trigger the reload in the parent window. To make that possible, just define the setting SOCIAL_AUTH_LOGIN_REDIRECT_URL = '/page/that/servers/the/js' and...

After user removes application access to his LinkedIn profile, next OAuth2 reauthorization fails

django,oauth-2.0,linkedin,python-social-auth

There's a discussion about this issue on the LinkedIn forums. Apparently this can happen if you move from OAuth1 to OAuth2. The proposed remedy until they resolve the problem is to create a new authentication key for our applications....

Zero Footprint Python-Social-Auth authentication

python,django,oauth,oauth-2.0,python-social-auth

I would try to approach this problem by using django.contrib.auth.models.Group and django.contrib.auth.models.Permission. Create one general group with custom permissions to your apps' functionality and add all your normal users to that. Save accounts created by python-social-auth in default django.contrib.auth.models.User but create seperate Group without any permissions for them. If necessary...

python-social-auth with django. Can't get user email in VK.com

django,email,vk,python-social-auth

I have just found how to fix it: https://github.com/omab/python-social-auth/pull/267 This fix will be added to pip distrib after 0.1.23 ...