Created
February 6, 2025 15:39
-
-
Save i-am-called-glitchy/ba34866323f2f35442704337b845e81b to your computer and use it in GitHub Desktop.
How to use a refresh token in Kirka.io (and other xsolla applications but this is for kirka specifically).
This file contains hidden or 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 aiohttp | |
| import asyncio | |
| async def async_exchange_refresh_token(refresh_token): | |
| url = "https://login.xsolla.com/api/oauth2/token" | |
| headers = { | |
| "Accept": "application/json", | |
| "Content-Type": "application/x-www-form-urlencoded", | |
| "Origin": "https://kirka.io", | |
| "Referer": "https://kirka.io/" | |
| } | |
| data = { | |
| "grant_type": "refresh_token", | |
| "client_id": "303", | |
| "redirect_uri": "https://kirka.io", | |
| "refresh_token": refresh_token | |
| } | |
| async with aiohttp.ClientSession() as session: | |
| async with session.post(url, headers=headers, data=data) as response: | |
| response.raise_for_status() | |
| return await response.json() | |
| ###################### | |
| import requests | |
| def exchange_refresh_token(refresh_token): | |
| url = "https://login.xsolla.com/api/oauth2/token" | |
| headers = { | |
| "Accept": "application/json", | |
| "Content-Type": "application/x-www-form-urlencoded", | |
| "Origin": "https://kirka.io", | |
| "Referer": "https://kirka.io/" | |
| } | |
| data = { | |
| "grant_type": "refresh_token", | |
| "client_id": "303", | |
| "redirect_uri": "https://kirka.io", | |
| "refresh_token": refresh_token | |
| } | |
| response = requests.post(url, headers=headers, data=data) | |
| response.raise_for_status() | |
| return response.json() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment