Comments (7)
It's been a long time, but I believe the key was forwarding the HTTP_HOST
which in Nginx looked like the following:
proxy_set_header Host $host;
And then including the protocol (because I had issues with HTTPS URIs):
SECURE_PROXY_SSL_HEADER=('HTTP_X_FORWARDED_PROTO', 'https')
I hope this helps.
from social-app-django.
I rather keep this out of the lib, building URIs is already done properly by the different frameworks we integrate with. In the case of Django, this library uses request.build_absolute_uri(path), which relies on _get_raw_host(), this method uses the following values (in the following order):
HTTP_X_FORWARDED_HOST
Header that can be set bynginx
(quite common practice, and I fail to see why that it's restrictive to spawn severalmy_portal
instances)HTTP_HOST
Header sent by the client, in the case ofmy_portal
the client is themy_proxy
, this value can be set bynginx
as well.SERVER_NAME
Environment value, you can set this in themy_portal
environment values when running it.
Setting any of the values above should get you going, the good thing about the options above, is that it lets you reuse the my_portal
instances and serve the same app under different hosts without any code change.
Another alternative is to override the built-in strategy and re-define the build_absolute_uri()
method to use you custom value, then set the SOCIAL_AUTH_STRATEGY
setting to point to your custom version.
from social-app-django.
Closing, reopen if still relevant.
from social-app-django.
This is really good guidance. I'm going to work on it a bit and see what I can come up with. HTTPS threw a wrench in my earlier approach so I need to do some more investigating.
from social-app-django.
@raymondberg could you outline what you ended up doing to resolve this?
I've set HTTP_X_FORWARDED_HOST from nginx, and tried the others mentioned above, but I still get this error.
from social-app-django.
I am attempting to do this in a development stack using Docker. Using proxy_set_header in NGINX sets the domain correctly in the redirect_callback, however the port port is now included. I can't see a way how to include that?
from social-app-django.
On my side, I believe I could definitely benefit from such a feature as I'm trying to connect a React app to social-app-django and my redirect uris will definitely be different.
I'm trying to override the default strategy as mentioned in this post, however I can't seem to get it to work. I'm getting a django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
. Is there a good place I could check about the proper way of defining a custom strategy?
from social-app-django.
Related Issues (20)
- Missing migrations in v5.1.0 ? HOT 10
- Only perform verification or update existing user
- Missing migrations on 5.2.0? HOT 2
- Django 4.2.2 breaks the way JSONField behaves HOT 1
- Question. Request additional Google Permissions outside of login flow
- SAML redirect loses session data storing "next" url and RelayState cannot be used instead
- Requiring POST method by default HOT 1
- Social Auth with Gmail SSO Causing Error --> 'str' object has no attribute 'get' HOT 2
- 5.2.0 not compatible with Django >= 4.2.2
- How to override a field of `AbstractUserSocialAuth` HOT 1
- IrreversibleError when migrating app zero for a new DB HOT 1
- Subclassing AbstractUserSocialAuth creates migration in social_django app. HOT 1
- 5.3.0 migrations feedback HOT 9
- Deprecated Sign In with LinkedIn HOT 2
- Enhance Django OAuth Library for Clean JSON Responses in API Development
- Linkedin complete login step is stuck
- AWS Cognito - Invalid scope error on authentication request HOT 1
- Update to social-core 4.5.2 HOT 1
- OPEN FOR MAINTAINERS
- Problem with facebook when email is added to scope, redirect url is not correct
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from social-app-django.