Skip to content
This repository has been archived by the owner on Feb 25, 2025. It is now read-only.

v1bt/riot-auth-manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Warning

No longer managed

Use https://github.com/RiisDev/RadiantConnect

Riot Auth Manager

Deploy with Vercel

An SDK that helps you obtain Riot access tokens via QR authentication.

Examples

Backend (Python)

Get Token and Cookies

import requests
import urllib.parse

BASE_URL = 'https://riot-auth.vercel.app'

headers = {'country-code': 'en-US'} # This header is optional and can be set to 'auto'.
response = requests.post(f'{BASE_URL}/login_url', headers=headers).json()
login_url = response.get('login_url')

session_cookies = response.get('session_cookies')
sdk_sid = response.get('sdk_sid')

enurl = urllib.parse.quote(login_url, safe=':/')
print('Scan QR code:', f'https://api.qrserver.com/v1/create-qr-code/?size=512x512&data={enurl}')
print('\nOr visit:', login_url)

input('\nPress Enter after auth..')

try:
    token_response = requests.post(
        f'{BASE_URL}/get_token',
        headers=headers,
        json={
            'session_cookies': session_cookies,
            'sdk_sid': sdk_sid
        }
    ).json()
except requests.exceptions.JSONDecodeError:
    print('Error: Invalid response from server. Please try again.')
    exit(1)

if token_response.get('type') == 'success':
    token = token_response['access_token']
    print('\nAccess Token:', token)

    print('\nUser Info:', requests.get('https://auth.riotgames.com/userinfo', 
        headers={'Authorization': f'Bearer {token}'}).json())

    print('\nCookies:')
    if 'cookies' in token_response:
        for cookie_name, cookie_value in token_response['cookies'].items():
            print(f'{cookie_name}: {cookie_value}')
    else:
        print('No cookies')
else:
    print('Error:', token_response.get('error', 'Unknown error occurred'))

Cookie Reauth

https://github.com/techchrism/riot-auth-test

import requests

BASE_URL = 'https://riot-auth.vercel.app'

ssid = ''

headers = {
    'ssid': ssid 
}

try:
    response = requests.post(
        f'{BASE_URL}/cookie_reauth',
        headers=headers
    ).json()
    
    if 'access_token' in response:
        token = response['access_token']
        print('\nAccess Token:', token)
        
        user_info = requests.get(
            'https://auth.riotgames.com/userinfo',
            headers={'Authorization': f'Bearer {token}'}
        ).json()
        print('\nUser Info:', user_info)
    else:
        print('Error:', response.get('error', 'Unknown error'))
        
except Exception as e:
    print('Error:', str(e))

With iFrame

Check out this demo

Use for store (Only 'kr')

<!DOCTYPE html>
<html>
<head>
    <title>Riot Auth</title>
    <style>
        .auth-frame {
            width: 430px;
            height: 1000px;
            border: none;
        }
    </style>
</head>
<body>
    <iframe src="https://riot-auth.vercel.app/auth/auto/" class="auth-frame"></iframe>
    <div id="token"></div>
    
    <script>
        window.addEventListener('message', function(event) {
            if (event.data.type === 'access_token') {
                const accessToken = event.data.token;
                document.getElementById('token').textContent = 'Access Token: ' + accessToken;
            }
        });
    </script>
</body>
</html>

Note

This project includes the source code of the easygoogletranslate module to minimize external dependencies.

About

SDK for Riot QR authentication API and GUI, etc.

Topics

Resources

License

Stars

Watchers

Forks

Languages