social-core icon indicating copy to clipboard operation
social-core copied to clipboard

Per-tenant OAuth2 Credentials

Open duplxey opened this issue 1 year ago • 0 comments

I have a multi-tenant Django app created using the django-tenants package. I successfully setup "global" social authentication using social_core.backends.google.GoogleOAuth2 backend.

Now, I'd like to allow tenants to provide their own Google OAuth2 credentials (client_id & client_secret) and authenticate through their own Google apps. Is there any way I can enable per tenant OAuth2 credentials? I'm talking about these two settings:

# these are global, but i'd like each tenant to have their own creds
SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = "<google_client_id>"
SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = "<google_client_secret>"

I also tried dynamically changing these two settings, but it looks like they're only evaluated on Django server startup (and then cached somewhere).

duplxey avatar Oct 11 '24 22:10 duplxey