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

Enforce User-Agent header to be set. Fixes #53 #55

Merged
merged 3 commits into from
Jan 24, 2025

Conversation

mschaeuble
Copy link
Contributor

@mschaeuble mschaeuble commented Jan 22, 2025

A User-Agent header is required for the login. Fixes #53 .

@andig
Copy link
Contributor

andig commented Jan 22, 2025

Just dont set the header at all and it will be present.

@mschaeuble
Copy link
Contributor Author

Just tried it: If the ua-header is not set explicitly, "Go-http-client/1.1" is used. But in this case, I get the 404 error again. Looks like Nissan is blocking some user agents.

@andig
Copy link
Contributor

andig commented Jan 22, 2025

…or thats the login error now?

@mschaeuble
Copy link
Contributor Author

Why don't you try it yourself? The behaviour is reproducible. I would not be suprised if they would try to block "non-official" requests. Ideally, we would set the user agent identical to the official app. Does anyone know what is set there?

@andig
Copy link
Contributor

andig commented Jan 22, 2025

Why don't you try it yourself?

I did. Doesn't work for me. That's why I've asked

…or thats the login error now?

@andig
Copy link
Contributor

andig commented Jan 24, 2025

@joeshaw could you kindly merge?

@andig
Copy link
Contributor

andig commented Jan 24, 2025

@mschaeuble or would you want to use a more common, non-easily-blockable UA string?

@mschaeuble
Copy link
Contributor Author

@andig Do you have any suggestion for a better UA string? Not sure if having a random UA string is better because Nissan could whitelist "official" user agents, which are currently not reverse-engineered as far as I know. I would prefer something neutral, such that the request cannot be tracked down to this project.

@andig
Copy link
Contributor

andig commented Jan 24, 2025

Something with Chrome?

@mschaeuble
Copy link
Contributor Author

"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36" ?

carwings.go Outdated

// A user agent is required. Using an unobtrusive value to not attract attention.
req.Header.Set("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36")
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formatierung...

@joeshaw joeshaw merged commit e366d59 into joeshaw:master Jan 24, 2025
1 check failed
@joeshaw
Copy link
Owner

joeshaw commented Jan 24, 2025

Thank you!

@mschaeuble mschaeuble changed the title Enforce User-Agent header to be set. Fixes #54 Enforce User-Agent header to be set. Fixes #53 Jan 28, 2025
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

Successfully merging this pull request may close these issues.

404 (INVALID PARAMS) error
3 participants