Last active
March 15, 2024 11:16
-
-
Save Luc1412/1f93257a2a808679ff014f258db6c35b to your computer and use it in GitHub Desktop.
This is the auth flow for valorant (async) + Some further research I did in the past
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import aiohttp | |
async def run(username, password): | |
session = aiohttp.ClientSession() | |
data = { | |
'client_id': 'play-valorant-web-prod', | |
'nonce': '1', | |
'redirect_uri': 'https://beta.playvalorant.com/opt_in', | |
'response_type': 'token id_token', | |
} | |
await session.post('https://auth.riotgames.com/api/v1/authorization', json=data) | |
data = { | |
'type': 'auth', | |
'username': username, | |
'password': password | |
} | |
async with session.put('https://auth.riotgames.com/api/v1/authorization', json=data) as r: | |
data = await r.json() | |
pattern = re.compile('access_token=((?:[a-zA-Z]|\d|\.|-|_)*).*id_token=((?:[a-zA-Z]|\d|\.|-|_)*).*expires_in=(\d*)') | |
data = pattern.findall(data['response']['parameters']['uri'])[0] | |
access_token = data[0] | |
print('Access Token: ' + access_token) | |
id_token = data[1] | |
expires_in = data[2] | |
headers = { | |
'Authorization': f'Bearer {access_token}', | |
} | |
async with session.post('https://entitlements.auth.riotgames.com/api/token/v1', headers=headers, json={}) as r: | |
data = await r.json() | |
entitlements_token = data['entitlements_token'] | |
print('Entitlements Token: ' + entitlements_token) | |
async with session.post('https://auth.riotgames.com/userinfo', headers=headers, json={}) as r: | |
data = await r.json() | |
user_id = data['sub'] | |
print('User ID: ' + user_id) | |
headers['X-Riot-Entitlements-JWT'] = entitlements_token | |
# Example Request. (Access Token and Entitlements Token needs to be included!) | |
async with session.get(f'https://pd.eu.a.pvp.net/match-history/v1/history/{user_id}?startIndex=0&endIndex=10', headers=headers) as r: | |
data = json.loads(await r.text()) | |
print(data) | |
await session.close() | |
if __name__ == '__main__': | |
asyncio.get_event_loop().run_until_complete(run('exmaple user name', 'my_secret_password')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
POST {URL}/rso-auth/v2/authorizations | |
POST {URL}/rso-auth/v1/session/credentials | |
Payload: {"username":"{USERNAME}","password":"{PASSOWORD}","persistLogin":false} | |
Response: {"country":"deu","error":"","multifactor":{"email":"","method":"method_not_set"},"persistLogin":false,"type":"authenticated"} | |
GET {URL}/riot-client-auth/v1/userinfo | |
Response: {"acct":{"game_name":"{RIOT_USER_NAME}","tag_line":"{RIOT_USER_TAG}"},"country":"deu","email_verified":true,"lol_account":{"summoner_name":"Luc1412"},"phone_number_verified":false,"player_plocale":null} | |
GET {URL}/rso-auth/v1/authorization | |
Response: {"currentAccountId": {ACCOUNT_ID},"currentPlatformId":"EUW1","subject":"b639ec2f-e2a0-509a-85f2-ffbec2526938"} | |
GET {URL}/rnet-product-registry/v4/products | |
Response: [{"id":"valorant","name":"VALORANT","patchlines":[{"auto_patching_enabled_by_player":false,"configType":"player","content_paths":{"loc":"https://valorant.secure.dyn.riotcdn.net/channels/public/rccontent/loc","riotstatus":"https://valorant.secure.dyn.riotcdn.net/channels/public","social":"https://valorant.secure.dyn.riotcdn.net/channels/public/rccontent/social"},"default_theme_manifest":"","dependencies":[{"args":[],"elevate":false,"hash":"","id":"vanguard","min_version":"","url":"","valid_exit_codes":"","version":""},{"args":["/quiet","/norestart"],"elevate":true,"hash":"","id":"VC++","min_version":"14.0.23026","url":"https://valorant.secure.dyn.riotcdn.net/x/riotclient/dependencies/vc_redist_x64.exe","valid_exit_codes":"1638","version":"14.0.23026"},{"args":["/silent"],"elevate":true,"hash":"","id":"DirectX","min_version":"1.0.0","url":"https://valorant.secure.dyn.riotcdn.net/x/riotclient/dependencies/DirectX_20190310.exe","valid_exit_codes":"","version":"1.0.0"}],"dependencyStates":{"DirectX":{"hash":"7eaf6eb2cfefebf2be59e43598e2bc881eb9012285a7bc2eedbb3d732466919b","phase":"Succeeded","version":"1.0.0"},"VC++":{"hash":"b6cc20d1e0b59ef7e485c2c2a8dfebd7f3ebc1674a21dbc146adc8d84e88d41c","phase":"Succeeded","version":"14.0.23026"},"vanguard":{"hash":"","phase":"NotInstalled","version":""}},"full_name":"VALORANT","id":"live","install_dir":"VALORANT/live","install_full_path":"D:/Program Files/Riot Games/VALORANT/live","install_id":"valorant.live","install_size_bytes":0,"launcher_arguments":[],"locale_data":{"available_locales":["en_US","de_DE","es_ES","fr_FR","it_IT","ko_KR","pl_PL","ru_RU","tr_TR"],"default_locale":"en_US"},"patch_notes":"","patch_status_known":false,"patching_ask_policy":"ask","patching_policy":"manual","path_name":"VALORANT","platform":"win","primary_executable":"","region_data":null,"release_id":"198A6AB4AADCDCB3","rogue_process_whitelist":[],"root_dir":"D:/Program Files/Riot Games","secondary_patchlines":[],"settings":{"create_shortcut":false,"create_uninstall_key":true,"locale":"en_US"},"shards_data":{},"theme_manifest":"https://valorant.secure.dyn.riotcdn.net/channels/public/rccontent/theme/closedbeta/default/manifest.json"}]}] | |
GET {URL}/rso-auth/v1/authorization/access-token | |
{"expiry":1587164699,"scopes":["openid","link","lol_region","lol","summoner","offline_access"],"token":"{TOKEN}"} | |
GET {URL}/entitlements/v1/token | |
{"accessToken":"{TOKEN}","entitlements":["urn:entitlement:valorantriot.valorant.closedbeta"],"issuer":"https://entitlements.auth.riotgames.com","subject":"b639ec2f-e2a0-509a-85f2-ffbec2526938","token":"{TOKEN}"} | |
GET https://auth.riotgames.com/userinfo | |
Headers: Authorization: Barear {URL}/rso-auth/v1/authorization/access-token | |
GET https://shared.eu.a.pvp.net/v1/config/eu | |
Headers: Authorization: Barear {URL}/rso-auth/v1/authorization/access-token | |
X-Riot-Entitlements-JWT: Token from {URL}/entitlements/v1/token | |
INFO ABOUT COMPETETIVE Tiers, last rank changes? | |
GET https://pd.eu.a.pvp.net/mmr/v1/players/{USER_ID} | |
Get data about the current players ingame profile settings (Background Card, Weapon Skins etc.) Maybe combine these with data drom datafiles | |
https://pd.eu.a.pvp.net/personalization/v2/players/{PLAYER_ID}/playerloadout | |
Get info about players contracts | |
GET https://pd.eu.a.pvp.net/contracts/v1/contracts/{PLAYER_ID} | |
Auth + Riot entitlements | |
Get current party | |
GET https://glz-eu-1.eu.a.pvp.net/parties/v1/players/{PLAYER_ID}?aresriot.aws-rclusterprod-euc1-1.eu-gp-frankfurt-1=50&aresriot.aws-rclusterprod-eun1-1.eu-gp-stockholm-1=31&aresriot.aws-rclusterprod-euw3-1.eu-gp-paris-1=58&aresriot.mtl-riot-ist1-2.eu-gp-istanbul-1=81 | |
Auth + Riot entitlements | |
Get matches (max. 20 at once) | |
GET https://pd.eu.a.pvp.net/match-history/v1/history/{PLAYER_ID}?startIndex=0&endIndex=10 | |
Auth + Riot entitlements | |
Get Match Info: | |
GET https://pd.eu.a.pvp.net/match-details/v1/matches/ec9a43b8-3a94-44e4-83c2-daf31a0b0bed | |
Auth + Riot entitlements | |
Store Stuff: | |
https://pd.eu.a.pvp.net/store/v1/offers/ | |
https://pd.eu.a.pvp.net/store/v2/storefront/b639ec2f-e2a0-509a-85f2-ffbec2526938 |
Is it possible to get the Entitlement token with official Riot OAuth?
Yeah
headers
{
'Content-Type': 'application/json',
'Authorization': f'Bearer <access_token>'
}
url
https://entitlements.auth.riotgames.com/api/token/v1
better later than never lol
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey I tried executing your script but I doesn't seem to work.
I'm getting errors specifically at Line 19/20