add more info on cookie reauth
tanishqmanuja opened this issue · 1 comments
tanishqmanuja commented
- pinging the cookie reauth endpoint requires ssid cookie
- endpoint redirects you to another page with access token in uri
- to get this access token programmatically you should disable redirect and parse
response.headers.location
Typescript snippet from https://github.com/tanishqmanuja/valorant-api-client
export async function getTokensUsingReauthStrategy(api: AuthApi) {
const reauthResponseUri = await api
.getCookieReauth({
maxRedirects: 0,
validateStatus: status => status === 303,
})
.then(res => res.headers["location"])
.catch((err: AxiosError) => err.response?.headers["location"]);
return parseTokensFromUri(reauthResponseUri);
}
Python snippet from https://github.com/LouisAsanaka/Valorant-Zone-Stats
redirect = session.get(ValorantAPI.REAUTH_URL, headers=headers, allow_redirects=False)
redirect_url: str = redirect.headers['Location']
res_dict = dict(parse.parse_qsl(parse.urlsplit(redirect_url).fragment))
techchrism commented
The ssid and redirection info is already in the docs. At least for now, I'd like to avoid using language/library specific examples, especially for something as simple as getting a redirect url.