Closed santhoshraju18 closed 7 years ago
By itself, the app won't support that schema, but you can override it simply by defining your own Facebook backend that overrides the get_key_and_secret()
method:
from social.backends.facebook import FacebookOAuth2
class CustomFacebook(FacebookOAuth2):
def get_key_and_secret(self):
key = get_facebook_app_key_based_on_some_rule()
secret = get_facebook_app_secret_based_on_some_rule()
return key, secret
Then use that backend by replacing social.backends.facebook.FacebookOAuth2
in the AUTHENTICATION_BACKENDS
setting with the import path to your CustomFacebook
one.
Okay thanks for helping with the workaround @omab. But the real problem for us is to pass instance id as an argument to the get_key_and_secret() method so as to obtain the auth_key and auth_secret from a different model.
Depends on your application, you can do it by:
self.strategy.request_data()
)this.strategy.session
Thanks @omab it really works using both steps 2 and 3 combined together. Closing this now.
Hi Guys,
Is there a way to use multiple social apps to integrate with each backend? Like I have two apps for Facebook and I want to dynamically use those app credentials to authenticate social users instead of specifying them in Django settings. Can this be done @omab ?
Thanks.