fix legacy auth_headers

This commit is contained in:
2025-01-26 14:40:47 +00:00
parent 4d25d9b5d3
commit f10da029ba
+3 -2
View File
@@ -19,8 +19,8 @@ export async function fetch_tokens(client_id,code,redirect_uri=location.origin+l
export function get_headers(tokens){ export function get_headers(tokens){
return { return {
'Authorization':'Bearer '+token.access_token, 'Authorization':'Bearer '+tokens.access_token,
'Client-ID':token.client_id 'Client-ID':tokens.client_id
} }
} }
@@ -28,6 +28,7 @@ export async function validate_tokens(tokens){
const validation=await TwitchAuth.validateToken(tokens.access_token) const validation=await TwitchAuth.validateToken(tokens.access_token)
Object.assign(tokens,validation) Object.assign(tokens,validation)
tokens.scope=validation.scopes tokens.scope=validation.scopes
tokens.auth_headers=get_headers(tokens)
token=tokens token=tokens
return token return token
} }