powerwall2: Unable to retrieve authentication token
I’m having issues getting an auth token from my Powerwall 2.
The password is definitely correct (as it works in the Powerwall setup wizard) but no matter what I try, I keep getting a login error saying my credentials are wrong.
HTTP/1.1 401 Unauthorized
Access-Control-Allow-Credentials: false
Access-Control-Allow-Headers: X-Requested-With, X-HTTP-Method-Override, Content-Type, Accept, Accept-Encoding, Authorization
Access-Control-Allow-Methods: GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS
Access-Control-Allow-Origin: *
Access-Control-Max-Age: 86400
Content-Type: application/json
X-Content-Type-Options: nosniff
Date: Wed, 04 Apr 2018 20:13:32 GMT
Content-Length: 66
{"code":401,"error":"Invalid Credentials","message":"Login Error"}
Any ideas?
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 18 (9 by maintainers)
Success! The escaped character version worked.
Nice one 😃 👍
Thanks for your help.
Ok, now I’m stumped. Here’s what I did on Windows 10 with curl 7.59.0
I tried your original request with the single quotes for the -d and it failed (401 Unauthorized)
./curl -s -i -X POST -H "Content-Type: application/json" -d '{"username":"jo e@rob.com","password":"STxxxxxxxxxx","force_sm_off":false}' http://192.168.xxx.xxx/api/login/Basic
Then I changed the single quotes to a double quote and escaped each double quote inside the -d section with a backslash and got a 200 response with a new token.
./curl -s -i -X POST -H "Content-Type: application/json" -d "{\"username\":\"jo e@rob.com\",\"password\":\"STxxxxxxxxxx\",\"force_sm_off\":false}" http://192.168.xxx.xxx/api/login/Basic
FWIW, this code is what the PW service is running
Dim LoginRequest As New LoginRequest With { .username = My.Settings.PWGatewayUsername, .password = My.Settings.PWGatewayPassword, .force_sm_off = False }