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 method needs url checking #37

Open
dylanmcreynolds opened this issue Feb 16, 2023 · 0 comments
Open

login method needs url checking #37

dylanmcreynolds opened this issue Feb 16, 2023 · 0 comments

Comments

@dylanmcreynolds
Copy link
Member

At some point, code to get a token based on the Users/loginmethod was changed to use urllib rather than string concatenation. urllib has a some deceptive behavior, however, based on whether the base url has a trailing slash or not.

urljoin(base_url, "Users/login"),

Observe the following:

urljoin("https://scicat/api/v3", "Users/login")
'https://scicat/api/Users/login'  <--- bad URL

urljoin("https://scicatv/api/v3/", "Users/login")
'https://scicat/api/v3/Users/login'  <-- good URL

So, if the caller does not add a trailing slash, urllib will produce a URL that fails to let the login work. This gets a little tricky, too, because the code silently fails tried msad auth, which on my system also fails.

We should maybe add code before using urllib to check for a trailing slash

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