michaelwoods / onstar2mqtt

OnStarJS wrapper for MQTT
MIT License
107 stars 40 forks source link

Request Failed with status 401 - Unauthorized #243

Closed glassbase closed 1 year ago

glassbase commented 1 year ago

getLocation not working for about a week. Response: Request Failed with status 401 - Unauthorized

Can we get https://github.com/michaelwoods/onstar2mqtt/pull/240 merged. Maybe that will fix.

BennyDaBee commented 1 year ago

Merged with my own branch. This does not fix it.

BigThunderSR commented 1 year ago

The entire OnStar app system went down yesterday with even the official GM apps not working. The official GM apps are working now, but we can no longer seem to run any commands via API, so it's possible that they blocked us again.

DevDylanB commented 1 year ago

Same thing here. I don't know why GM is like this. Ford has a dedicated website for all their API docs.

info: Connected to MQTT info: Subscribed to command topic {"topic":"homeassistant/xxxxxxx/command"} info: Requesting diagnostics error: Error {"error":{"message":"Request Failed with status 401 - Unauthorized","request":{"method":"POST"},"response":{"data":{"error":"invalid_token"},"headers":{"cache-control":"\"no-store\"","connection":"keep-alive","content-length":"32","content-type":"\"application/json; charset=UTF-8\"","date":"Sun, 08 Jan 2023 19:58:17 GMT","pragma":"\"no-cache\"","request-context":"appId=cid-v1:x"},"status":401,"statusText":"Unauthorized"},"stack":"Error: Request Failed with status 401 - Unauthorized\n at RequestService.<anonymous> (/app/node_modules/onstarjs/dist/index.js:594:32)\n at Generator.throw (<anonymous>)\n at rejected (/app/node_modules/onstarjs/dist/index.js:33:65)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)"}}

nodiaque commented 1 year ago

Hello, ok for the error, but not for the other problem (that I have for multiple days, still today). All the log says is "requesting diagnostics" and nothing never get received or sent to MQTT, and command doesn't work.

tylerpieper commented 1 year ago

@nodiaque, see the comments on the OnStarJS issue - there was an update to OnStar which broke OnStarJS. That needs to be resolved, and then those changes can get merged into onstar2mqtt.

nodiaque commented 1 year ago

My bad, I missread the last comment, just saw what you are talking about, my bad.

DuncanIdahoCT commented 1 year ago

My guess would be it's related to GM rolling out MFA for onstar related app accounts. When I noticed it wasn't working, I immediately opened my app to see if that was working and I was prompted to use MFA. I also received this interestingly timed message (within the app) about how using 3rd party services to access onstar violates the usage agreement and could result in... blah blah blah, etc, etc...

BigThunderSR commented 1 year ago

My guess would be it's related to GM rolling out MFA for onstar related app accounts. When I noticed it wasn't working, I immediately opened my app to see if that was working and I was prompted to use MFA. I also received this interestingly timed message (within the app) about how using 3rd party services to access onstar violates the usage agreement and could result in... blah blah blah, etc, etc...

I had MFA enabled on my account long before this issue and it was working fine for several months back then, so I personally don't think it is related to MFA.

DuncanIdahoCT commented 1 year ago

It seems like if MFA was enabled but not required, it could work but since we're using a normal (not meant for this method) to sign in, once MFA is required, I don't see how it will just stay working... I'm not sure if any of you also use Nest with HA but there is a hack for that whereby you retrieve the oath token from Chrome dev console and use it in the integration, was similar before I moved to HA from SmartThings. It works but of course the oath token can become invalidated now and then and you must update it. I only mention in case it sparks ideas :) as I was enjoying this until I noticed my fuel tank level hadn't changed in a few weeks lol. I disclaim all of the above with "I'm not a developer"

michaelwoods commented 1 year ago

I have a pending PR that may fix the issue. It would be helpful if someone with a functional remote commands package could test that those still work with the token upgrade disabled.

https://github.com/samrum/OnStarJS/pull/215

waynehead99 commented 1 year ago

I just updated myself to the latest pull and I am still getting the 401 error. I do have a valid plan currently if that matters at all

info: Requesting diagnostics error: Error {"error":{"message":"Request Failed with status 401 - Unauthorized"

michaelwoods commented 1 year ago

Fixed in v1.5.3.

@waynehead99 double check your version

waynehead99 commented 1 year ago

Yep... I must've pulled the image too soon... repulled and confirmed, I am working agian.

Thanks!

DuncanIdahoCT commented 1 year ago

Working for me now too, thanks!