Skip to main content

GET_getByAccessToken

await client.GET_getByAccessToken(authorization, cluster=None)
Get the account associated with an RSO (Riot Sign-On) access token. Use this after completing the OAuth2 flow via create_RSO_link.
ParameterTypeDescription
authorizationstrThe RSO access token
clusterstr, optionalOverrides the default cluster. Valid values: americas, asia, esports, europe
Returns: AccountDto or dict Raises: InvalidCluster, RiotAPIResponseError

Example

import valaw
import asyncio

async def main():
    client = valaw.Client("YOUR_TOKEN", "americas")
    try:
        # access_token comes from your OAuth2 callback handler
        access_token = "Bearer <token-from-oauth-flow>"
        account = await client.GET_getByAccessToken(access_token)
        print(f"Authenticated as: {account.gameName}#{account.tagLine}")
    finally:
        await client.close()

asyncio.run(main())
Never expose access tokens in client-side code or logs. Always transmit tokens over HTTPS.