evcc icon indicating copy to clipboard operation
evcc copied to clipboard

Hyundai Token login doesn't work

Open chrisherzberg opened this issue 2 months ago • 24 comments

Description

evcc will not einable my Kona

Steps to Reproduce

  1. generate refresh token
  2. Konfigure the Kona within the webfrontend
  3. Endet up with the error messagen creating vehicle db:5 failed: cannot create vehicle type 'template': cannot create vehicle type 'hyundai': login failed: unexpected redirect after signin: https://idpconnect-eu.hyundai.com/auth/api/v2/user/oauth2/authorize?response_type=code&client_id=4f4953b5-02e1-4dbc-8599-87e983ee1be5&redirect_uri=https%3A%2F%2Foneapp.hyundai.com%2Fredirect&state=ccsp&scope=&nonce=&connector_client_id=4f4953b5-02e1-4dbc-8599-87e983ee1be5&connector_scope&orgHmgSid&reqUsername=cherzberg%40gmx.de

⚠️ RETURN TO EVCC TAB → COPY STEP 2 → PASTE HERE

Version

v0.316.0

System

linux/arm64, CEST +02:00

chrisherzberg avatar Sep 26 '26 09:09 chrisherzberg

Thanks for the report! This looks like a known pattern rather than a new bug.

For EU Hyundai/Kia/Genesis, the password config field accepts either an account password or an externally generated refresh_token. Since Kia/Hyundai blocked the legacy login flow in August 2026, external tools can no longer mint a new refresh_token — only one obtained before that change still works (see templates/definition/vehicle/hyundai.yaml). If a stale/invalid refresh_token is used, evcc falls back to the password-based OneApp/CCI login (vehicle/bluelink/cci.go) using that same string as if it were the account password, which then fails at the sign-in step with exactly the "unexpected redirect after signin" error you're seeing — because the string isn't your real account password.

Could you confirm:

  • Did you put a freshly-generated refresh_token (from an external tool) into the password field, or your actual Hyundai account password?
  • If a refresh_token, can you try again with your account password instead?

Also, your issue body is missing the config/logs section (the placeholder text RETURN TO EVCC TAB → COPY STEP 2 → PASTE HERE wasn't replaced) — if the above doesn't resolve it, please paste your YAML/UI vehicle config (with credentials redacted) and the debug logs so we can look closer.

🤖 Generated with Claude Code

github-actions[bot] avatar Sep 26 '26 09:09 github-actions[bot]

I had this same issue today (it worked yesterday when charging my Ioniq 5). Tried generating a new token which also failed, but after reading the above comment and testing using my Bluelink account/password it works again.

pellz0r avatar Sep 27 '26 10:09 pellz0r

So I tried the python bluelink for my KIA to update my refresh token - which resolved in that output:

[1/4] Loading authorize page...
  ✅ Session established
[2/4] Fetching RSA public key...
  ✅ Password encrypted
[3/4] Signing in...
  ❌ Signin returned HTTP 403
     <html>
<head><title>403 Forbidden</title></head>
<body>
<center><h1>403 Forbidden</h1></center>
</body>
</html>
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friend

Then I tried the --browser solution, which returned in a Bad Request 400:

Fehlercode: 400 Ungültige Anforderung
Bad Request. It was classified as an abusing request and blocked. client_id : xxxx

So did KIA again change something in their auth process?

rogatec avatar Sep 29 '26 08:09 rogatec

@rogatec use your password instead of a token

VolkerK62 avatar Sep 29 '26 11:09 VolkerK62

@rogatec use your password instead of a token

💡 thanks!

rogatec avatar Sep 29 '26 11:09 rogatec

Fix: Kia (EU) in EVCC – "login failed: unexpected redirect after signin". But should also work for Hyundai.

If evcc shows cannot create vehicle type 'kia': login failed: unexpected redirect after signin: https://idpconnect-eu.kia.com/auth/api/v2/user/oauth2/authorize?...&reqUsername=..., Kia rejected your login. EVCC itself is fine. Kia has moved to a new account system (the one used by the new "Kia" app). Your password can still work in the old Kia Connect app while the new system rejects it.

What fixed it for me:

  1. Check whether Kia/Hyundai accepts your login. Open this link in a browser and sign in with your Kia/Hyundai email and password: https://idpconnect-eu.kia.com/auth/api/v2/user/oauth2/authorize?response_type=code&client_id=01b36c86-79e8-486c-8009-15f2ad88d670&redirect_uri=https://oneapp.kia.com/redirect&state=ccsp&country=nl (replace nl with your country code and the id with the id from the error message and kia with hyundai ). If you see "Please check your email or password", the problem is your Kia account, not EVCC.
  2. Use your account password in EVCC, not a refresh token. The refresh-token generators in the EVCC wiki no longer work for EU accounts.
  3. Make your account work in the new system. Click "Reset Password" on that login page and set a password, or sign in once in the new Kia/Hyundai app (not "Kia Connect") and complete any account steps.
  4. Sign in on the link from step 1 again. If it no longer shows the error, enter the same password in EVCC and click "Validate". The SOC should appear.

WoBoW4U avatar Oct 01 '26 10:10 WoBoW4U

Using Passwort instead of Token works for me. Strange (KIA)

Snited avatar Oct 01 '26 16:10 Snited

Hi, i got the same error message, even if I am using my hyundai pwd. I am able to login at hyundai or via bluelink mobile app. But it does not work within evcc. Here is my trace log

[hyundai] TRACE 2026/10/03 20:47:59 POST https://idpconnect-eu.hyundai.com/auth/api/v2/user/oauth2/token
[hyundai] TRACE 2026/10/03 20:47:59 client_id=6d477c38-3ca4-4cf3-9557----&client_secret=----V&grant_type=refresh_token&refresh_token=*** -- {"retId":"842a5609-79e2-4d52-8956-----","retCode":7501,"retMsg":"Received unexpected statusCode","retSubMsg":"{\"errId\":\"3297a60f-47d4-49ac-8129-9a36ef6fb9e6\",\"errCode\":\"4002\",\"errMsg\":\"Invalid parameters\",\"errBody\":null}","retValue":null}
[hyundai] DEBUG 2026/10/03 20:47:59 cci: using persisted token
[hyundai] TRACE 2026/10/03 20:47:59 POST https://prd.eu-ccapi.hyundai.com:8080/api/v1/spa/notifications/register
[hyundai] TRACE 2026/10/03 20:47:59 {"pushRegId":"9EBC5723075248430D51BF4A087AFEA4E36639FEC1C248A920944E07----","pushType":"GCM","uuid":"4bf0993b-92e2-4109-9897-----"}
[main ] ERROR 2026/10/03 20:47:59 creating vehicle db:32 failed: cannot create vehicle type 'template': cannot create vehicle type 'hyundai': error getting device id: deviceid not found
[site ] INFO 2026/10/03 20:48:00 vehicle 'car' does not support automatic detection
[hyundai] TRACE 2026/10/03 20:48:10 POST https://idpconnect-eu.hyundai.com/auth/api/v2/user/oauth2/token
[hyundai] TRACE 2026/10/03 20:48:10 client_id=6d477c38-3ca4-4cf3-9557-----&client_secret=----&grant_type=refresh_token&refresh_token=*** -- {"retId":"ea86b765-3759-4fb5-ab43-d24f7384728e","retCode":7501,"retMsg":"Received unexpected statusCode","retSubMsg":"{\"errId\":\"a94bace2-0ee9-4bd8-b40c-e57d3f21a9b3\",\"errCode\":\"4002\",\"errMsg\":\"Invalid parameters\",\"errBody\":null}","retValue":null}
[hyundai] DEBUG 2026/10/03 20:48:10 cci: using persisted token
[hyundai] TRACE 2026/10/03 20:48:10 POST https://prd.eu-ccapi.hyundai.com:8080/api/v1/spa/notifications/register
[hyundai] TRACE 2026/10/03 20:48:10 {"pushRegId":"2E1487C2FFC9735EC8F12AF158D4364C5AEEC800DFF0E42----","pushType":"GCM","uuid":"d81044fd-07d6-409f-9bd6----"}
[hyundai] TRACE 2026/10/03 20:48:16 POST https://idpconnect-eu.hyundai.com/auth/api/v2/user/oauth2/token
[hyundai] TRACE 2026/10/03 20:48:16 client_id=6d477c38-3ca4-4cf3-9557-----&client_secret=---&grant_type=refresh_token&refresh_token=*** -- {"retId":"5463b021-9b40-43d1-ba0e-ce680031818d","retCode":7501,"retMsg":"Received unexpected statusCode","retSubMsg":"{\"errId\":\"7b2d2e99-8289-4c60-a1d3-fa728659243e\",\"errCode\":\"4002\",\"errMsg\":\"Invalid parameters\",\"errBody\":null}","retValue":null}
[hyundai] DEBUG 2026/10/03 20:48:16 cci: using persisted token
[hyundai] TRACE 2026/10/03 20:48:16 POST https://prd.eu-ccapi.hyundai.com:8080/api/v1/spa/notifications/register
[hyundai] TRACE 2026/10/03 20:48:16 {"pushRegId":"8AC5943155514AF98E312091BDA35297DCB9403EEA40BC1A5---","pushType":"GCM","uuid":"be6aee5e-ea5a-4070-9cbe----"}
[db ] TRACE 2026/10/03 20:48:16 UPDATE `configs` SET `class`=3,`type`='template',`disable`=false,`title`='',`icon`='',`product`='Hyundai Bluelink',`value`='{"autodetectdisabled":false,"cache":"15m","climaterdisabled":false,"icon":"car","language":"de","password":"d---","priority":0,"region":"Europe","template":"hyundai","title":"car","user":"---,"wakeupdisabled":false}' WHERE `id` = 32 1 <nil

hankie77 avatar Oct 03 '26 19:10 hankie77

@WoBoW4U the link does not work with hyundai or i have somewhere an issue https://idpconnect-eu.hyundai.com/auth/api/v2/user/oauth2/authorize?response_type=code&client_id=6d477c38-3ca4-4cf3-9557-2a1929-----&redirect_uri=https://oneapp.hyundai.com/redirect&state=ccsp&country=de

Fehlercode: 400 Ungültige Anforderung Bad Request! invalid redirectUri: https://oneapp.hyundai.com/redirect

hankie77 avatar Oct 03 '26 19:10 hankie77

Same for me (KIA) - login with the credentials for the link above works fine, but in EVCC (v0.317.0) I am getting an error:

[kia ] DEBUG 2026/10/09 15:41:33 cci: logging in via OneApp/CCI password login [main ] ERROR 2026/10/09 15:41:33 creating vehicle kia failed: cannot create vehicle type 'template': cannot create vehicle type 'kia': login failed: unexpected redirect after signin: https://idpconnect-eu.kia.com/auth/api/v2/user/oauth2/authorize?response_type=code&client_id=01b36c86-79e8-486c-8009-15f2ad88d670&redirect_uri=https%3A%2F%2Foneapp.kia.com%2Fredirect&state=ccsp&scope=&nonce=&connector_client_id=01b36c86-79e8-486c-8009-15f2ad88d670&connector_scope&orgHmgSid&reqUsername=XXXXXX&connector_session_key=

miurlit avatar Oct 09 '26 13:10 miurlit

you can try the official way https://docs.evcc.io/de/vehicles/kia-eu-data-act/

also available for Hyundai https://docs.evcc.io/de/vehicles/hyundai-eu-data-act/ and Genesis https://docs.evcc.io/de/vehicles/genesis-eu-data-act/

For further information and experiences see https://github.com/evcc-io/evcc/discussions/34434

VolkerK62 avatar Oct 09 '26 14:10 VolkerK62

Found the issue, the old password was too long...

miurlit avatar Oct 09 '26 17:10 miurlit

Affect kia too.

Fix is n the way according to the repo with the original library https://github.com/Hyundai-Kia-Connect/kia_uvo/issues/1939#issuecomment-6173593891

Getiem avatar Oct 14 '26 18:10 Getiem

See the Kia Connect fix : https://github.com/Hyundai-Kia-Connect/hyundai_kia_connect_api/pull/1352

Getiem avatar Oct 15 '26 05:10 Getiem

17. See the Kia Connect fix : Hyundai-Kia-Connect/hyundai_kia_connect_api#1352

Hello, since yesterday I can't authenticate my Kia Car. Is it still working for you ? Do I need to use my password or the refresh token ?

Gouvy83 avatar Oct 15 '26 07:10 Gouvy83

I just installed v0.318.0-dev.1792030683, but login still failed (area Gemany, Hyundai IONIQ 5). Here are the error messages:

Using uname and password: cannot create vehicle type 'template': cannot create vehicle type 'hyundai': login failed: cci token exchange failed: unexpected status: 400 (Bad Request) POST https://cci-api-eu.hyundai.com/domain/api/v1/auth/token?code=353c8264-8ad0-45a8-a3c9-beecb4532a2d.6aba664b-...

Using uname and my current refresh token (hopefully still valid): cannot create vehicle type 'template': cannot create vehicle type 'hyundai': login failed: unexpected redirect after signin: https://idpconnect-eu.hyundai.com/auth/api/v2/user/oauth2/authorize?response_type=code&client_id=4f4953b5-02e1-4dbc-...&redirect_uri=https%3A%2F%2Foneapp.hyundai.com%2Fredirect&state=ccsp&scope=&nonce=&connector_client_id=4f4953b5-02e1-4dbc-8599...5&connector_scope&orgHmgSid&reqUsername=tz%40thomas-zehbe.de&connector_session_key= So authentication is still broken. The fix in the original library (https://github.com/Hyundai-Kia-Connect/kia_uvo/issues/1939#issuecomment-6173593891) is not yet applied for evcc.

tzdisco4 avatar Oct 15 '26 09:10 tzdisco4

In the EU I think we should use "Hyundai EU Data Act" when adding a car in evcc. I did it this morning and got it working again!

You need to create an account at https://pleos.ai/playground/vehicle-data-api and generate an API key for your car, then add the client ID and client secret when adding the car in evcc.

pellz0r avatar Oct 15 '26 11:10 pellz0r

I created an account, requested an api key and a client ID, etered these in the car defintion dialog, but check shows an error message:

cannot create vehicle type 'template': cannot create vehicle type 'hyundai': login failed: unexpected redirect after signin: https://idpconnect-eu.hyundai.com/auth/api/v2/user/oauth2/authorize?response_type=code&client_id=XXX&redirect_uri=https%3A%2F%2Foneapp.hyundai.com%2Fredirect&state=ccsp&scope=&nonce=&connector_client_id=4f4953b5-02e1-4dbc-8599-87e983ee1be5&connector_scope&orgHmgSid&reqUsername=XXX&connector_session_key=

I tried the combinations email+secret and client-id+secret without success. My guess is that the wrong URL is used to authenticate. Could this be?

tzdisco4 avatar Oct 15 '26 14:10 tzdisco4

21. I created an account, requested an api key and a client ID, etered these in the car defintion dialog, but check shows an error message: cannot create vehicle type 'template': cannot create vehicle type 'hyundai': login failed: unexpected redirect after signin: https://idpconnect-eu.hyundai.com/auth/api/v2/user/oauth2/authorize?response_type=code&client_id=XXX&redirect_uri=https%3A%2F%2Foneapp.hyundai.com%2Fredirect&state=ccsp&scope=&nonce=&connector_client_id=4f4953b5-02e1-4dbc-8599-87e983ee1be5&connector_scope&orgHmgSid&reqUsername=XXX&connector_session_key= I tried the combinations email+secret and client-id+secret without success. My guess is that the wrong URL is used to authenticate. Could this be?

Did you use "Hyundai EU Data Act" when adding a new car i evcc? And did you add any other values? I got a similar error when I entered the battery capacity and used comma instead of dot as a decimal separator.

pellz0r avatar Oct 15 '26 14:10 pellz0r

No, I didn't. Many thanks for your hint! The field where this information should be given is not editable once the car is created. So i missed that this mus also be changed. Now I get a connection to my IONIQ, but this seems to be useless as this data act cloud does not show the current values. Especially for the SOC. So it is not a solution, IMO.

Edit: An now, after restart I get this:

Request failed with status code 400.cannot create vehicle type 'template': cannot create vehicle type 'hyundai': login failed: unexpected redirect after signin: https://idpconnect-eu.hyundai.com/auth/api/v2/user/oauth2/authorize?response_type=code&client_id=4f4953b5-02e1-4dbc-8599-87e983ee1be5&redirect_uri=https%3A%2F%2Foneapp.hyundai.com%2Fredirect&state=ccsp&scope=&nonce=&connector_client_id=4f4953bxxx&connector_scope&orgHmgSid&reqUsername=a6a6717b-7c29-3bxxxx&connector_session_key=.POST http://192.168.25.87:7070/api/config/test/vehicle/merge/6

and this:

Image

Edit 2: A second restart solved the last issue ...

tzdisco4 avatar Oct 15 '26 15:10 tzdisco4