Skip to content

Hyundai Kia: Refresh Token

RenatusRo edited this page Oct 29, 2025 · 3 revisions

bluelink_refresh_token

This scripts helps owners of cars made by Hyundai or Kia to retrieve the refresh_token that is now necessary to access the Bluelink API in the integrations for HomeAssistant and evcc.

It is a combination of the separate efforts of @fuatakgun (original Kia implementation) and @Maaxion (Hyundai aption)

Prerequisites

You need to have the following installed on your computer

Important

On Windows installations make sure to set the check at "Add Python 3.x to PATH" in the installer

  1. Python3 >= 3.12
  2. wget (Linux/MacOS) or iwr (Windows)
  3. Chrome or a Chromium based Brower

Preparations

  1. Copy the script from below to your local hard drive:

    1. Linux/MacOS
      wget -O bluelinktoken.py https://gist.github.com/RustyDust/e2a7be978affd85fb5ef5a345f31f67a/raw/3504e7f086be19caf182e208a4327ad841f5b1e7/bluelinktoken.py
    2. Windows
      Run in powershell:
      iwr -UseBasicParsing -OutFile bluelinktoken.py https://gist.github.com/RustyDust/e2a7be978affd85fb5ef5a345f31f67a/raw/3504e7f086be19caf182e208a4327ad841f5b1e7/bluelinktoken.py
  2. Prepare the python runtime environment (you do have Python3 installed, right?)

    1. Linux/MacOS

      python3 -m venv .venv
      source .venv/bin/activate
      pip3 install selenium requests
    2. Windows

      Do not double click the python file to run it. If you do, the terminal will close after the program ends, giving you no chance to copy the refresh token.

      Open cmd in the same dir you downloaded the Python file into (or continue in the powershell from the previous step):

      python -m venv .venv
      .\.venv\Scripts\Activate.ps1
      python -m pip install --upgrade pip
      pip install selenium requests webdriver-manager

Running the Script

Note

You should still be in the Python environment from step 2.1 or 2.2 from above!

Kia

  1. Linux/MacOS:
    python ./bluelinktoken.py --brand kia
  2. Windows:
    python .\bluelinktoken.py --brand kia

Hyundai

  1. Linux/MacOS:
    python ./bluelinktoken.py --brand hyundai
  2. Windows:
    python .\bluelinktoken.py --brand hyundai

The script will automatically open your browser (you did install Chrome, yes?) with the correct URL for your vehicle's brand. Log in using the credentials (username / password) you use in the app on your mobile phone.

If everything worked as expected you'll get an output in your terminal similar to this:

Opening login page: https://idpconnect-eu.(kia/hyundai).com/auth/api/v2/user/oauth2/authorize?(...shortened...)

==================================================
Please log in manually in the browser window.
The script will wait for you to complete the login...
==================================================

✅ Login successful! Element found.

✅ Your tokens are:

- Refresh Token: M2M2OG................................YOTG5
- Access Token: eyJhbGc.........................0_AijpHXp0yg
Cleaning up and closing the browser.

Usage in Home Assistant or evcc

Use the Refresh Token from above as the password together with your normal username when setting up either the HomeAssistant or evcc integration for your vehicle.

Note

The refresh token you generated is valid for 180 days. After that period you'll have to generate a new one and reconfigure your integrations

Clone this wiki locally