Get hoyoverse API token (Hoyolab Miyoushe) - zvyap/Hoyoverse-API GitHub Wiki
Before start
[!NOTE]
[!CAUTION] Make sure you keep your token properly, leak of the token may cause your account got access by others. Log out the Hoyolab AS FAST AS POSSIBLE if you realize your token leaked.
Easy Way or Manual Way
Proceed withEasy
Right click
> Inspect
Console
tab
Select Paste code below into your console
(()=>{if(document.cookie.includes('ltoken')&&document.cookie.includes('ltuid')){const e=document.createElement('input');try{e.value=`${t('ltuid')},${t('ltoken')}`}catch(o){console.warn('readCookie is still undefined');const t=e=>{const o=`; ${document.cookie}`.split(`; ${e}=`);if(2===o.length)return o.pop().split(';').shift()};e.value=`${t('ltuid')},${t('ltoken')}`}document.body.appendChild(e),e.select(),navigator.clipboard.writeText(e.value),prompt('Success! Token is copied to clipboard. You may manually copy the token below:\n',e.value)}else alert('Token has expired. Please signin again.')})();
Credit: https://gist.github.com/blueaxis/77847e63522fc747450ef718b68719ee
Enter
Press id
and token
TADA~ You got the [!NOTE] Your
id
is on the left side of the comma (Red Highlight) Yourtoken
is on the right side of the comma (Green Highlight)
Manual
Right click
> Inspect
Application
tab
Select Cookies
section
Select the URL of the website in the ltuid
and ltoken
, copy the value down
Search for Note: If ltuid
& ltoken
is not exist, use ltuid_v2
& ltoken_v2
instead, just copy all value in the cookie without any change
Note for developer: Use HoyoToken#of
instead of manually create the HoyoToken object. If do, please make sure you are using the right object HoyoToken / HoyoTokenV2