Python – Added a new backend in Python Social Auth

Added a new backend in Python Social Auth… here is a solution to the problem.

Added a new backend in Python Social Auth

The documentation for python-social auth describes how to add an authentication backend, but does not explain where to put the newly supported CLIENT_ID and CLIENT_SECRET.

Here is the documentation in question: http://python-social-auth.readthedocs.io/en/latest/backends/implementation.html#oauth

Solution

I implemented it this way :

from django.conf import settings

class CustomOAuth2(BaseOAuth2):
    name = 'custom'

def get_key_and_secret(self):
        return settings. CUSTOM_OAUTH_CLIENT_ID, settings. CUSTOM_OAUTH_CLIENT_SECRET

Related Problems and Solutions