social-app-django | Python Social Auth - Application - Django | Authentication library

 by   python-social-auth Python Version: 5.2.0 License: BSD-3-Clause

kandi X-RAY | social-app-django Summary

kandi X-RAY | social-app-django Summary

social-app-django is a Python library typically used in Security, Authentication applications. social-app-django has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has medium support. You can install using 'pip install social-app-django' or download it from GitHub, PyPI.

This is the Django component of the python-social-auth ecosystem, it implements the needed functionality to integrate social-auth-core in a Django based project.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              social-app-django has a medium active ecosystem.
              It has 1820 star(s) with 346 fork(s). There are 35 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 128 open issues and 144 have been closed. On average issues are closed in 165 days. There are 2 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of social-app-django is 5.2.0

            kandi-Quality Quality

              social-app-django has 0 bugs and 10 code smells.

            kandi-Security Security

              social-app-django has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              social-app-django code analysis shows 0 unresolved vulnerabilities.
              There are 10 security hotspots that need review.

            kandi-License License

              social-app-django is licensed under the BSD-3-Clause License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              social-app-django releases are available to install and integrate.
              Deployable package is available in PyPI.
              Build file is available. You can build the component from source.
              Installation instructions are not available. Examples and code snippets are available.
              social-app-django saves you 668 person hours of effort in developing the same functionality from scratch.
              It has 1549 lines of code, 153 functions and 39 files.
              It has low code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed social-app-django and discovered the below as its top functions. This is intended to give you an instant insight into social-app-django implemented functionality, and help decide if they suit your requirements.
            • Process an exception
            • Raise an exception if the given exception is raised
            • Returns the URL to redirect to
            • Return the message
            • A decorator that sets social strategy
            • Load a backend
            • Load a strategy
            • Returns a list of search fields
            • Return a list of all field names
            • Return the user model
            • Perform login
            • Returns the session expiration time for the given provider
            • Return the username of the given user
            • Disconnect from an entry
            • Removes models from the database
            • Convert value to string
            • Convert database value to python value
            • Load the requirements txt file
            • Return a User instance
            • Destroys the model
            • Get users by email address
            • Returns the length of the username field
            • Read the version number from the django
            • Check if a user exists
            • Delete expired codes
            • Return the long description
            Get all kandi verified functions for this library.

            social-app-django Key Features

            No Key Features are available at this moment for social-app-django.

            social-app-django Examples and Code Snippets

            No Code Snippets are available at this moment for social-app-django.

            Community Discussions

            QUESTION

            Login-error page not displayed when using python-social-auth
            Asked 2019-Apr-17 at 11:46

            I am using social-app-django (part of python-social-auth) to implement Facebook login for the users of my Django site. I have a requirement that users must be found in the local user database before they can log in with Facebook. I have replaced the auth_allowed-part of the authentication pipeline, to perform this check:

            ...

            ANSWER

            Answered 2019-Apr-17 at 11:46

            I think I solved the problem: I accidentally used

            Source https://stackoverflow.com/questions/55712456

            QUESTION

            How to set verbose_name for external app model in Django?
            Asked 2018-Oct-13 at 18:05

            I'm trying to set verbose_name for a model SocialAuthUser from django_social.

            I've tried to use proxy model, setting its Meta.verbose_name to desired value, but had no success (probably I did it wrong). If it's the way to go, I can provide more details.

            It would be great to avoid installing module from pip in editable mode just to replace verbose_name in admin site.

            Probably I can replace model name in admin site in some other way? I thought about adding custom link to admin site, but didn't research this method yet because it feels hacky.

            ...

            ANSWER

            Answered 2018-Oct-13 at 18:05

            You almost got it right. For your changes on the proxy model to take effect you need to unregister the model from admin site first and then register the proxy model.

            The example below is for social_django.Association model.

            Source https://stackoverflow.com/questions/52793905

            QUESTION

            For some reason google oauth2 can signup into same user with different gmail emails
            Asked 2018-May-25 at 07:42

            Sometimes when user signups with his gmail account to my service and then he signups with his G Suite account, both emails create record in UserSocialAuth model but to same django User. Can someone help me understand why this happens and how to avoid it? I need both gmail accounts have separate django accounts.

            I am using social-auth-app-django https://github.com/python-social-auth/social-app-django

            My pipeline

            ...

            ANSWER

            Answered 2018-May-04 at 08:17

            The issue seems to be with associate_by_email config in the pipeline. Removing that config would create a new user for all new social logins.

            According to the doc:

            if a user signed up with his Facebook account, then logged out and next time tries to use Google OAuth2 to login, it could be nice (if both social sites have the same email address configured) that the user gets into his initial account created by Facebook backend.

            Read more here: http://python-social-auth.readthedocs.io/en/latest/use_cases.html#associate-users-by-email

            Source https://stackoverflow.com/questions/50111232

            QUESTION

            Django Social Login: 'AsgiRequest' object has no attribute 'session'
            Asked 2018-Apr-25 at 16:36

            Got an error when trying social-app-django (2.1.0), the error thrown was:

            'AsgiRequest' object has no attribute 'session'

            • Running with channels 1.1.8, Django 2.0.3, asgi-redis 1.2.0, python 3.6
            • Running via python manage.py runserver (development environment) not uwgsi or nginx.

            The occurs when trying to access /social/login/google-oauth2/ (authenticating with google account).

            I have read about changing MIDDLEWARE_CLASSES to MIDDLEWARE but we have been using Django >=1.9 for a while so it has already been changed.

            The traceback looks as follows:

            Traceback (most recent call last):
            File "/lib/python3.6/site-packages/django/core/handlers/exception.py", line 35,in inner
            response = get_response(request)

            File "/lib/python3.6/site-packages/django/core/handlers/base.py", line 128, in _get_response
            response = self.process_exception_by_middleware(e, request)

            File "/lib/python3.6/site-packages/channels/handler.py", line 243, in process_exception_by_middleware
            return super(AsgiHandler, self).process_exception_by_middleware(exception, request)

            File "/lib/python3.6/site-packages/django/core/handlers/base.py", line 126, in _get_response
            response = wrapped_callback(request, *callback_args, **callback_kwargs)

            File "/lib/python3.6/site-packages/django/views/decorators/cache.py", line 44, in _wrapped_view_func
            response = view_func(request, *args, **kwargs)

            File "/lib/python3.6/site-packages/social_django/utils.py", line 38, in wrapper
            request.social_strategy = load_strategy(request)

            File "/lib/python3.6/site-packages/social_django/utils.py", line 23, in load_strategy
            return get_strategy(STRATEGY, STORAGE, request)

            File "/lib/python3.6/site-packages/social_core/utils.py", line 279, in get_strategy
            return Strategy(Storage, *args, **kwargs)

            File "/lib/python3.6/site-packages/social_django/strategy.py", line 39, in init
            self.session = request.session if request else {}
            AttributeError: 'AsgiRequest' object has no attribute 'session'

            Middleware is the following (added because other WsgiRequest has no attribute session have been related with middleware):

            ...

            ANSWER

            Answered 2018-Apr-25 at 16:36

            The problem was with middleware. I upgraded from Django>=1.9 to 2.0.3. SessionAuthenticationMiddleware was removed. When debugging middleware I found this:

            ImportError: Module "django.contrib.auth.middleware" does not define a "SessionAuthenticationMiddleware" attribute/class

            The solution was to removed it. The reason why didn't it logged it out before it is unknown.

            You can read more about this here:

            SessionAuthenticationMiddleware removed release notes

            Source https://stackoverflow.com/questions/50026755

            QUESTION

            How to handle AuthAlreadyAssociated at Python-auth/Django-Social?
            Asked 2018-Feb-23 at 14:14

            I use this python-social-auth/social-app-django to connect my web with social media I want to ask how to handle errors when the same account is used to sign up?

            For example, I signed up using facebook and I signed up again using twitter. both successfully registered into two separate accounts, when I logged in using my facebook and then on my account settings page, I want to connect my twitter that has been registered before it will display an error message

            "AuthAlreadyAssociated at / oauth / complete / twitter /"

            AuthAlreadyAssociated

            This message appears after I authorize on the twitter redirect page when it gets redirected back to my web.

            In short, how to deal with accounts that have been registered in other accounts?

            This is my views.py:

            ...

            ANSWER

            Answered 2018-Feb-23 at 14:14

            Your question has been answered here: AuthAlreadyAssociated Exception in Django Social Auth

            Basically the answer is to override the default method process_exception() in the social_auth.middleware.SocialAuthExceptionMiddleware class, and add this middleware to your settings.py.

            More on how to override here: How do I handle exceptions on Python Social Auth

            Source https://stackoverflow.com/questions/47143112

            QUESTION

            How to make facebook authentication pop-ups using python-social-auth
            Asked 2017-Oct-29 at 10:15

            I'm using social-auth-app-django with FacebookOAuth2 backend what is based on python-social-auth and trying to set display=popup at facebook authentication trought app settings.

            Found this old issue for django-social-auth what is deprecated in favor of python-social-auth, but that options doesn't work.

            ...

            ANSWER

            Answered 2017-Oct-29 at 10:15

            You can add below line to your settings

            SOCIAL_AUTH_FACEBOOK_AUTH_EXTRA_ARGUMENTS = { 'display': 'popup', }

            I found out it from the source code: https://github.com/python-social-auth/social-core/blob/master/social_core/backends/base.py#L203

            Source https://stackoverflow.com/questions/44908695

            QUESTION

            python-social-auth generate 'connect with' link as string
            Asked 2017-Aug-29 at 09:12

            I'm using social-auth-app-django to support logins with social apps. This code is on a angular-djangorest app, so basically the django doesn't serve the html pages.

            Now from the docs, I can see that if I did serve the html pages, I would simply add the following line to generate the 'connect with' link:

            ...

            ANSWER

            Answered 2017-Aug-29 at 09:12

            {% url 'social:begin' 'instagram' %}

            in normal django python code would be:

            from django.urls import reverse
            reverse('social:begin', args=['instagram'])

            ending up like this:

            Source https://stackoverflow.com/questions/45934465

            QUESTION

            Extend User Model or Custom Pipeline in Social-App-Django
            Asked 2017-Aug-21 at 05:07

            I am implementing social-app-django (not the deprecated one; the one that relies on Python-social-auth) with django 1.11 (not using Mongo). My application will need to store and manipulate a lot of data on users other than that which is fetched from their social media accounts at login.

            I don't need to fetch or collect any extra data when the user authenticates, but various actions they perform on my site will need to be saved to their user model. I am wondering which of the following approaches is preferred (I've searched extensively online, but can't find a specific explanation of why to use one vs the other):

            • Create my own user model in my app's models.py (call it MyUser) that doesn't extend anything special, and then add a function in the authentication pipeline that associates the social-app-django user with a corresponding instance of MyUser. Leave AUTH_USER_MODEL and SOCIAL_AUTH_USER_MODEL unchanged.

              or...

            • Create my own user model in my app's models.py, and in the project's settings.py set AUTH_USER_MODEL and SOCIAL_AUTH_USER_MODEL to point to MyUser. Leave the pipeline unchanged. In this case, I was wondering whether someone could clarify what MyUser and its manager should extend, and what I need to import in modules.py (I am confused because a lot of stack overflow posts are referring to deprecated versions of this module and I keep getting errors). Also, in this case should I be setting both AUTH_USER_MODEL and SOCIAL_AUTH_USER_MODEL, or just one of them?

            Do these two methods essentially achieve the same thing? Is one more reliable/preferred for some reason? Or, should I be doing both? Thanks very much for any assistance.

            Another detail: I would like to be able to access the User database not only from the app I am currently building, but also from other apps (within the same Django project) that I will build in the future. Does this affect anything?

            ...

            ANSWER

            Answered 2017-Aug-21 at 05:07

            Since I see this has a decent number of views I will post the solution I eventually came to.

            Both django and social-app-django (or any other social auth module) make use of the default User model for authentication. While it's possible to edit this model to add custom parameters, I don't recommend it. It's not good abstraction or modularization. If you make a mistake when configuring the model, you won't just break a specific feature on your site, but you might also break the authentication itself.

            The only circumstances I can think of under which you'd want to edit the default user model itself is if you need to make changes that affect the authentication flow itself (for example, adding your own custom authentication provider).

            It's much easier and safer to create a new model called UserProfile, with a required one-to-one relationship to a User object. Now, you can treat the User object as the authentication part, and the UserProfile object as the content/storage part. You won't have to mess with the User model very often, and the UserProfile model doesn't matter for authentication purposes. Note that in this configuration you should NOT need to change the AUTH_USER_MODEL or SOCIAL_AUTH_USER_MODEL fields in the settings.py file.

            If you take this approach, you will need to add a custom step in the authentication pipeline in which you create a new UserProfile object and associate it with the User who is currently logging in.

            Source https://stackoverflow.com/questions/45153041

            QUESTION

            How can I refresh the token with social-auth-app-django?
            Asked 2017-May-31 at 09:09

            I use Python Social Auth - Django to log in my users.

            My backend is Microsoft, so I can use Microsoft Graph but I don't think that it is relevant.

            Python Social Auth deals with authentication but now I want to call the API and for that, I need a valid access token. Following the use cases I can get to this:

            ...

            ANSWER

            Answered 2017-May-31 at 09:09

            Using load_strategy() at social.apps.django_app.utils:

            Source https://stackoverflow.com/questions/41466731

            QUESTION

            Integrate python-social-auth (social-app-django) to be used with the Django admin
            Asked 2017-Apr-07 at 12:13

            I want to create an app that uses the django admin, but allows logins via google (my company google account) in place of the django default ModelAdmin.

            Currently, it looks like social-app-django (google) is the way to go, but after having installed and setup a project, it's not clear to me how I can allow django admin logins to use the social-app-django authentication. I've attempted to configure my project as described here http://python-social-auth.readthedocs.io/en/latest/configuration/django.html but it isn't clear how this can be integrated with the django admin.

            I found this snippit (which seems out-of-date), and added it, but get a 404 when I try to goto /admin/:

            Page not found (404) Request Method: GET Request URL: http://127.0.0.1:8000/accounts/login/?next=/admin/login/%3Fnext%3D/admin/ Using the URLconf defined in telos.urls, Django tried these URL patterns, in this order: ^login/(?P[^/]+)/$ [name='begin'] ^complete/(?P[^/]+)/$ [name='complete'] ^disconnect/(?P[^/]+)/$ [name='disconnect'] ^disconnect/(?P[^/]+)/(?P[^/]+)/$ [name='disconnect_individual'] ^admin/ The current path, accounts/login/, didn't match any of these.

            If I remove the snippit, /admin/ will redirect to /admin/login/ and on login attempt return the ERROR text:

            Please enter the correct username and password for a staff account. Note that both fields may be case-sensitive.

            In addition to the configuration, I've added the following to my settings.py:

            projects/models.py (MyUser)

            ...

            ANSWER

            Answered 2017-Apr-07 at 12:13

            Django Admin uses the auth contrib application, so any authentication process triggers the same mechanism than a user logging in to a non-admin section and it will be processed by python-social-auth backends if they are defined in AUTHENTICATION_BACKENDS setting.

            In order to make it work you will need to:

            1. Add a Login with Google link (linking to /login/google-oauth2) to the login form. You can override the default login form by adding a admin/login.html template or by defining a custom AdminSite
            2. Ensure that the user is flagged as is_staff, otherwise access to the admin will be forbidden.

            Source https://stackoverflow.com/questions/43246790

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install social-app-django

            You can install using 'pip install social-app-django' or download it from GitHub, PyPI.
            You can use social-app-django like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.

            Support

            Project documentation is available at http://python-social-auth.readthedocs.org/.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/python-social-auth/social-app-django.git

          • CLI

            gh repo clone python-social-auth/social-app-django

          • sshUrl

            git@github.com:python-social-auth/social-app-django.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular Authentication Libraries

            supabase

            by supabase

            iosched

            by google

            monica

            by monicahq

            authelia

            by authelia

            hydra

            by ory

            Try Top Libraries by python-social-auth

            social-core

            by python-social-authPython

            social-examples

            by python-social-authPython

            social-docs

            by python-social-authHTML

            social-app-flask

            by python-social-authPython

            social-app-flask-sqlalchemy

            by python-social-authPython