Refresh Token funtion updated
This commit is contained in:
parent
e0d0332747
commit
658d5b9726
@ -158,17 +158,10 @@ export async function RefreshToken(): Promise<true | false>{
|
|||||||
|
|
||||||
if(typeof response === 'number') return false
|
if(typeof response === 'number') return false
|
||||||
let resp_json = JSON.parse(response.body)
|
let resp_json = JSON.parse(response.body)
|
||||||
spotifyData = {
|
spotifyData.access_token = resp_json.access_token
|
||||||
client_id : spotifyData.client_id,
|
spotifyData.expires_in = Number(resp_json.expires_in)
|
||||||
client_secret : spotifyData.client_secret,
|
spotifyData.expiry = Date.now() + (Number(resp_json.expires_in) * 1000)
|
||||||
redirect_url : spotifyData.redirect_url,
|
spotifyData.token_type = resp_json.token_type
|
||||||
access_token : resp_json.access_token,
|
|
||||||
refresh_token : spotifyData.refresh_token,
|
|
||||||
expires_in : Number(resp_json.expires_in),
|
|
||||||
expiry : Date.now() + (Number(resp_json.expires_in) * 1000),
|
|
||||||
token_type : resp_json.token_type,
|
|
||||||
market : spotifyData.market
|
|
||||||
}
|
|
||||||
fs.writeFileSync('.data/spotify.data', JSON.stringify(spotifyData, undefined, 4))
|
fs.writeFileSync('.data/spotify.data', JSON.stringify(spotifyData, undefined, 4))
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user