Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

login redirect url #56

Closed
ghost opened this issue Sep 3, 2015 · 5 comments
Closed

login redirect url #56

ghost opened this issue Sep 3, 2015 · 5 comments

Comments

@ghost
Copy link

ghost commented Sep 3, 2015

I usually use the default server from django to make my development: python manager.py runserver (no different port/ip). Which makes the straight forward configuration to use this app (without need to override a thing) produces a invalid redirect URL for the providers login request. But even if i change my ip to localhost the redirect URL still being evaluated as 127.0.0.1 which is not a valid address for redirections.

I think if we could check the base domain and make a swift translation from 127.0.0.1 to localhost without anymore modification over the code. I think something like that is useful because i don't think it's a good flow to test the logins only on stage environments. I thought about include the redirect URL as a column over the table or use some settings.py variable like:

ALLACCESS = {
    "facebook": {
        "scopes": [],
        "redirect": "localhost:8000/some_url.html"
    }
}
@mlavin
Copy link
Owner

mlavin commented Sep 3, 2015

I don't understand what you are asking for here. I've tested this running on localhost:8000 for a number of providers.

127.0.0.1 which is not a valid address for redirections.

If a provider won't allow 127.0.0.1 or localhost you can always use an alias in your hosts file. I often use dev.example.com for this purpose. I don't understand the problem you are trying to solve here.

@ghost
Copy link
Author

ghost commented Sep 3, 2015

  1. Provide allow use localhost but not 127.0.0.1 ip.
  2. change host file on development is just hackery which can be avoid with good patterns

The problem is that the address sent as redirect URL is always 127.0.0.1 even if i when i set it to localhost which i understand is normal, but i think on this case could be more useful to check it before calling the provider's page and translate it to localhost which is a valid address for providers like facebook, google and stuff.

Right now i can start a server with the pattern "[loca_machine_name].local" and set the same address over the provider profile pages. This is just fine with you're a lone wolf on a lone project if not you will force everyone to rename their PC to use it.

I've made a briefly research and maybe adjusting the admin.site, but i don't need this even to upload the project to my stage environments.

TL;DR provider understand that localhost/127.0.0.1 are not the same for them. Which is good and allow me to test locally, but i need to make this distinction from 127.0.0.1 to localhost before send the redirect url. Just it :)

@mlavin
Copy link
Owner

mlavin commented Sep 3, 2015

The problem is that the address sent as redirect URL is always 127.0.0.1 even if i when i set it to localhost

I'm not seeing this when using the example project. Accessing the site on http://localhost:8000/ to sign into Facebook populates the redirect_url based on http://localhost:8000/. This worked end-to-end.

change host file on development is just hackery

I'm sorry but I don't agree. It's a simple, straightforward, and repeatable solution particularly for providers which don't allow for localhost or 127.0.0.1 as the callback domain.

It sounds like you are having a problem but it isn't coming through clearly here. I'm open to improvements to this project but I can tell you that any proposal which includes adding settings is unlikely to be accepted. Configuration through Django settings isn't in line with the approach of this project.

@ghost
Copy link
Author

ghost commented Sep 3, 2015

Yeah. It's weird. I was expecting the localhost:8000 being passed as redirect, but it's not. I will try investigate more later. I think for now we can close this so.

@mlavin
Copy link
Owner

mlavin commented Oct 18, 2015

Closing as noted.

@mlavin mlavin closed this as completed Oct 18, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant