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

Redirect after authentication on http://localhost without / #501

Closed
atzimot opened this issue Jul 26, 2024 · 8 comments · Fixed by #507
Closed

Redirect after authentication on http://localhost without / #501

atzimot opened this issue Jul 26, 2024 · 8 comments · Fixed by #507
Labels
bug Something isn't working ship soon

Comments

@atzimot
Copy link

atzimot commented Jul 26, 2024

After a succesful auth the app doesn't redirect to the base url
I redirecting to /authorize?code= and is displaying a white page
If I delete /authorize?code= the app loads
What do i have to do ?

oidc = writer.auth.Oidc(
client_id="xxx",
client_secret="xxxx",
host_url=os.getenv('HOST_URL', "http://localhost:33081"),
url_authorize="http://localhost:33050/connect/authorize",
url_oauthtoken="http://localhost:33050/connect/token",
url_userinfo='http://localhost:33050/connect/userinfo',
scope="openid profile common"
)

This is my settings

@FabienArcellier
Copy link
Collaborator

At the end of the authentication flow, your browser receives a 307 Temporary Redirect redirect to http://localhost:33081. Is this response visible in your browser's network inspector? could you share a screenshot of the network inspector ?

@FabienArcellier FabienArcellier added the question Further information is requested label Jul 26, 2024
@atzimot
Copy link
Author

atzimot commented Jul 26, 2024

image

image

@FabienArcellier
Copy link
Collaborator

FabienArcellier commented Jul 26, 2024

As the Location looks empty, the I suppose HOST_URL environment variable exists and contains an empty string "".

image

Could you try this code ?

host_url = os.getenv('HOST_URL', "http://localhost:33081")
if host_url is not None and host_url.strip() == "":
    host_url="http://localhost:33081"

oidc = writer.auth.Oidc(
    client_id="xxx",
    client_secret="xxxx",
    host_url=host_url,
    url_authorize="http://localhost:33050/connect/authorize",
    url_oauthtoken="http://localhost:33050/connect/token",
    url_userinfo='http://localhost:33050/connect/userinfo',
    scope="openid profile common"
)

@atzimot
Copy link
Author

atzimot commented Jul 27, 2024

no smae issue the app doesn't redirect to http://localhost:33081/. If i delete the part after / the app loads

I have found after redirect I have this cookies
image
but if i delete the part i have only this cookies
image

Th session cokie is deleted and app loads

@atzimot
Copy link
Author

atzimot commented Jul 30, 2024

I have found that in auth.py on line 213 if host_url_path='' then the redirect doesn't work but if host_url_path='/' works

@FabienArcellier FabienArcellier added the bug Something isn't working label Aug 1, 2024
@FabienArcellier
Copy link
Collaborator

I will investigate what we can do to make this situation more easy to handle.

@FabienArcellier FabienArcellier changed the title Redirect after Authentication Redirect after authentication on http://localhost without / Aug 5, 2024
@FabienArcellier FabienArcellier removed the question Further information is requested label Aug 13, 2024
@FabienArcellier
Copy link
Collaborator

the fix has been released in 0.7.0rc2

pip install writer==0.7.0rc2

@atzimot
Copy link
Author

atzimot commented Aug 19, 2024

thanks I will test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ship soon
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants