mirror of
https://github.com/anidl/multi-downloader-nx.git
synced 2026-04-21 16:31:55 +00:00
[ADN] Fix refresh token request
This commit is contained in:
parent
5cbead06bc
commit
423ad7b2c9
1 changed files with 3 additions and 6 deletions
9
adn.ts
9
adn.ts
|
|
@ -216,19 +216,16 @@ export default class AnimationDigitalNetwork implements ServiceClass {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${this.token.accessToken}`,
|
Authorization: `Bearer ${this.token.accessToken}`,
|
||||||
'Cookie': `adnrt=${this.token.refreshToken}`,
|
'X-Access-Token': this.token.accessToken,
|
||||||
'X-Access-Token': this.token.accessToken
|
'content-type': 'application/json'
|
||||||
},
|
},
|
||||||
body: '{}'
|
body: JSON.stringify({refreshToken: this.token.refreshToken})
|
||||||
});
|
});
|
||||||
if(!authReq.ok || !authReq.res){
|
if(!authReq.ok || !authReq.res){
|
||||||
console.error('Token refresh failed!');
|
console.error('Token refresh failed!');
|
||||||
return { isOk: false, reason: new Error('Token refresh failed') };
|
return { isOk: false, reason: new Error('Token refresh failed') };
|
||||||
}
|
}
|
||||||
this.token = await authReq.res.json();
|
this.token = await authReq.res.json();
|
||||||
const cookies = this.parseCookies(authReq.res.headers.get('Set-Cookie'));
|
|
||||||
//this.token.refreshtoken = this.token.refreshToken;
|
|
||||||
this.token.refreshToken = cookies.adnrt;
|
|
||||||
yamlCfg.saveADNToken(this.token);
|
yamlCfg.saveADNToken(this.token);
|
||||||
return { isOk: true, value: undefined };
|
return { isOk: true, value: undefined };
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue