-
Notifications
You must be signed in to change notification settings - Fork 3
Get hoyoverse API token (Hoyolab Miyoushe)
zvyap edited this page Mar 4, 2024
·
7 revisions
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.
Proceed with Easy Way or Manual Way
(()=>{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
Note
Your id
is on the left side of the comma (Red Highlight)
Your token
is on the right side of the comma (Green Highlight)
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