I don't know why this would be unauthorized. I checked that the api_key
and puuid
are correct. When I made a request to another Riot API in a similar way, I got the desired result (status code: 200). I'm guessing there is a typo in the URL that sent the request, but I can't find where it went wrong.
import fetch from 'node-fetch'
const getMatchList = async () => {
const puuid = 'XXXXXXXX'
const api_key = 'XXXXXXX'
const res = await fetch(
`https://asia.api.riotgames.com/lol/match/v5/matches/by-puuid/${puuid}/ids?start=0&count=1?api_key=${api_key}`
)
const myJson = await res.json()
console.log(myJson) // { status: { message: 'Unauthorized', status_code: 401 } }
}