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

Remove cookie handling #272

Closed
jschlyter opened this issue Dec 14, 2024 · 4 comments · Fixed by #275
Closed

Remove cookie handling #272

jschlyter opened this issue Dec 14, 2024 · 4 comments · Fixed by #275
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@jschlyter
Copy link
Contributor

Polestar uses cookies as part of the authentication process resulting in conflicts when trying to authenticate with different accounts in the same Home Assistant instance. This is most likely the problem that triggers the errors discovered by @magnushacker and others. I'm not sure how to fix this though, perhaps we can use a dedicated httpx.Client per device.

@jschlyter jschlyter added bug Something isn't working help wanted Extra attention is needed labels Dec 14, 2024
@jschlyter jschlyter self-assigned this Dec 14, 2024
@BJReplay
Copy link

Hmm, the luxury of multiple vehicles that presumably comes with multiple accounts.

Not having access to more than one account or vehicle, the only thing that I can think is that when I had a loan car from Polestar, I had added it to my Polestar app on my phone, and the app allowed me to switch between the loan car and the yet to be delivered vehicle that Polestar had tied to my account as I had ordered it via that account.

I also know that you can invite family and friends to to your Polestar via the app.

Screenshot_20241215_091713.jpg

I wonder if the solution is instead of multiple accounts and cookie clashes, it is a single account, with multiple vehicles, with the vehicles shared, if necessary to the account logged into HA?

If this works, we could write it up in the readme.

@magnushacker
Copy link

magnushacker commented Dec 15, 2024

We have two cars in the family, and our own separate accounts that are set as owners in the cars, and we have added the other car to our accounts. In the app, we both can switch between the cars and all options are there. Initially, we only had one car but still had separate accounts. This means that my car was the first car associated with my wife's Polestar account.

In HA, I was able to use only a single integration entry up until a while ago and it would find both devices. I then had to switch to use two integration entries with different accounts and provide the VIN of the car in the configuration. I just noticed that this has now also stopped working.

For both accounts, only the first car shows up when adding the integration entry and if i provide the VIN of the second car it doesn't find any cars at all. And as the first car on both accounts is mine, I currently can't get my wife's car to show in HA.

@BJReplay
Copy link

Thanks, @magnushacker that is really helpful, and, unfortunately, shoots down my thought that sharing a car to another account would be the solution.

@jschlyter if I had another vehicle associated with my account 😉, I could capture the Android app sequence if that would help.

I see that your community question is the first Google hit for homeassistant httpx client!

@jschlyter
Copy link
Contributor Author

I've create separate httpx clients for now, see #275 for a possible solution. This might fix the issue that @magnushacker has.

@jschlyter jschlyter linked a pull request Dec 18, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants