Hello, sumad200, I dont know how to contact with you so I write here.
I try to do local project for personal usage to check what's new in my valorant shop and night market from my telegram bot.
But I have error on auth, I use bun (or nodejs) for my app.
// Make the first request to obtain session cookies
const step1Response = await fetch('https://auth.riotgames.com/api/v1/authorization', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
client_id: 'riot-client',
code_challenge: '',
code_challenge_method: '',
acr_values: '',
claims: '',
nonce: '69420',
redirect_uri: 'http://localhost/redirect',
response_type: 'token id_token',
scope: 'openid link ban lol_region',
}),
})
// Check the response status and cookies
if (!step1Response.ok) {
console.error('Step 1 failed:', await step1Response.text())
return
}
// Extract cookies from the response
const setCookieHeader = step1Response.headers.get('set-cookie')
if (!setCookieHeader) {
console.error('No cookies received from Step 1')
return
}
// Prepare cookies for the second request
const cookies = setCookieHeader.split(', ').map(cookie => cookie.split(';')[0]).join('; ')
// Make the second request using the cookies
const step2Response = await fetch('https://auth.riotgames.com/api/v1/authorization', {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
'Cookie': cookies, // Pass cookies from Step 1
},
body: JSON.stringify({
remember: true,
type: 'auth',
username: process.env.RIOT_USERNAME,
password: process.env.RIOT_PASSWORD,
}),
})
console.log(
process.env.RIOT_USERNAME,
process.env.RIOT_PASSWORD,
)
const step2Data = await step2Response.json()
if (!step2Response.ok) {
console.error('Step 2 failed:', step2Data)
} else {
console.log('Step 2 successful:', step2Data)
}
}
test()
Step 2 successful: {
type: "auth",
error: "auth_failure",
country: "ukr",
}
Hello, sumad200, I dont know how to contact with you so I write here.
I try to do local project for personal usage to check what's new in my valorant shop and night market from my telegram bot.
But I have error on auth, I use bun (or nodejs) for my app.
Here my code
but server respond me 200, but with next response:
What I doing wrong?