You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First I wanna thank you for such great job with this project, it has been a real help for me. I have been using python-social-auth for a couple of months in my django project, and I realized that if I am setting up a redirect_uri with https in my Google app for google-oauth2 auth it was automatically changed to a uri with http, so I dive into this. And realized of the following:
On your documentation you said that we must set in settings.py:
SOCIAL_AUTH_REDIRECT_IS_HTTPS = True
So all redirects uses https, for some reason this setting is not being used, instead if you go into social.strategies.base you can see on line 188 the following code for the function absolute_uri:
uri = self.build_absolute_uri(path)
if self.setting('ON_HTTPS'):
uri = uri.replace('http://', 'https://')
return uri
I couldn't find any information on your documentation regarding that ON_HTTPS setting, so I added it, and it solved the first problem with the redirect_uri with https.
But after that If for some reason I need to execute again on my Django app a load_strategy function, it raises an Exception telling me that None object has replace function. So I come to the following fix that at least on my case and using many API social providers works perfectly for me:
replace on social.strategies.base.py
def absolute_uri(self, path=None):
uri = self.build_absolute_uri(path)
if self.setting('ON_HTTPS'):
uri = uri.replace('http://', 'https://')
return uri
with this:
def absolute_uri(self, path=None):
uri = self.build_absolute_uri(path)
if uri and self.setting('SOCIAL_AUTH_REDIRECT_IS_HTTPS'):
uri = uri.replace('http://', 'https://')
return uri
Please tell me If I am missing something on this problem and should avoid this patch for my problem.
PD: Sorry for my bad english.
Thanks!
The text was updated successfully, but these errors were encountered:
Hi,
First I wanna thank you for such great job with this project, it has been a real help for me. I have been using python-social-auth for a couple of months in my django project, and I realized that if I am setting up a redirect_uri with https in my Google app for google-oauth2 auth it was automatically changed to a uri with http, so I dive into this. And realized of the following:
On your documentation you said that we must set in settings.py:
SOCIAL_AUTH_REDIRECT_IS_HTTPS = True
So all redirects uses https, for some reason this setting is not being used, instead if you go into social.strategies.base you can see on line 188 the following code for the function absolute_uri:
uri = self.build_absolute_uri(path)
if self.setting('ON_HTTPS'):
uri = uri.replace('http://', 'https://')
return uri
I couldn't find any information on your documentation regarding that ON_HTTPS setting, so I added it, and it solved the first problem with the redirect_uri with https.
But after that If for some reason I need to execute again on my Django app a load_strategy function, it raises an Exception telling me that None object has replace function. So I come to the following fix that at least on my case and using many API social providers works perfectly for me:
replace on social.strategies.base.py
def absolute_uri(self, path=None):
uri = self.build_absolute_uri(path)
if self.setting('ON_HTTPS'):
uri = uri.replace('http://', 'https://')
return uri
with this:
Please tell me If I am missing something on this problem and should avoid this patch for my problem.
PD: Sorry for my bad english.
Thanks!
The text was updated successfully, but these errors were encountered: