fix: remote auth

This commit is contained in:
Elysia 2023-07-12 01:14:38 +07:00
parent 50d7a4443d
commit c5d1b8d93a

View File

@ -460,7 +460,7 @@ new DiscordAuthWebsocket({
).json(); ).json();
if (res?.captcha_key) { if (res?.captcha_key) {
this.captchaCache = res; this.captchaCache = res;
} else { } else if (!res.encrypted_token) {
this._throwError(new Error('Request failed. Please try again.', res)); this._throwError(new Error('Request failed. Please try again.', res));
this.captchaCache = null; this.captchaCache = null;
} }
@ -470,7 +470,7 @@ new DiscordAuthWebsocket({
const token = await this.options.captchaSolver(this.captchaCache); const token = await this.options.captchaSolver(this.captchaCache);
return this._findRealToken(token); return this._findRealToken(token);
} }
this.realToken = this._decryptPayload(res.data.encrypted_token).toString(); this.realToken = this._decryptPayload(res.encrypted_token).toString();
/** /**
* Emitted whenever a real token is found. * Emitted whenever a real token is found.
* @event DiscordAuthWebsocket#finish * @event DiscordAuthWebsocket#finish