Giter Site home page Giter Site logo

Comments (7)

raymondberg avatar raymondberg commented on June 1, 2024 5

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.

omab avatar omab commented on June 1, 2024 4

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 by nginx (quite common practice, and I fail to see why that it's restrictive to spawn several my_portal instances)
  • HTTP_HOST
    Header sent by the client, in the case of my_portal the client is the my_proxy, this value can be set by nginx as well.
  • SERVER_NAME
    Environment value, you can set this in the my_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.

omab avatar omab commented on June 1, 2024 2

Closing, reopen if still relevant.

from social-app-django.

raymondberg avatar raymondberg commented on June 1, 2024

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.

goshlanguage avatar goshlanguage commented on June 1, 2024

@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.

leesolway avatar leesolway commented on June 1, 2024

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.

andreimarinescu avatar andreimarinescu commented on June 1, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.