Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ManuelBlanc/4728120699f3b413287c0b3864a6bee8 to your computer and use it in GitHub Desktop.
Save ManuelBlanc/4728120699f3b413287c0b3864a6bee8 to your computer and use it in GitHub Desktop.
League of Legends - Unequip challenge tokens
##
## PowerShell script to remove all equipped challenge tokens.
## (2023-04-19) Donated to the public domain
## Method credit: https://www.reddit.com/r/leagueoflegends/comments/w91xqk/comment/iip126n/
##
# Obtain the port & auth code of the LCU local server.
$command_line = (Get-WmiObject Win32_Process -Filter "name = 'LeagueClientUx.exe'").CommandLine
$command_line -match '--remoting-auth-token=(\w+)'
$LOL_AUTH = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes("riot:$($matches[1])"))
$command_line -match '--app-port=(\d+)'
$LOL_PORT = $matches[1]
# Send the request to clear the challenge tokens.
$ReqParams = @{
Uri = "https://127.0.0.1:${LOL_PORT}/lol-challenges/v1/update-player-preferences/"
Method = 'POST'
ContentType = 'application/json'
Body = '{"challengeIds":[]}'
SkipCertificateCheck = $true # Not available on PowerShell 5. Workaround: https://stackoverflow.com/a/59924223
UserAgent = 'ChallengesAreEvil'
Headers = @{
Accept = 'application/json'
Authorization = "Basic ${LOL_AUTH}"
}
}
Invoke-WebRequest @ReqParams
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment