diff --git a/lib/OAuth.js b/lib/OAuth.js index ee907973..ef6ac243 100644 --- a/lib/OAuth.js +++ b/lib/OAuth.js @@ -13,8 +13,7 @@ class OAuth extends EventEmitter { this.oauth_code_url = `${Constants.URLS.YT_BASE_URL}/o/oauth2/device/code`; this.oauth_token_url = `${Constants.URLS.YT_BASE_URL}/o/oauth2/token`; - this.guide_url = `${Constants.URLS.YT_BASE_URL}/youtubei/v1/guide`; - + this.model_name = Constants.OAUTH.MODEL_NAME; this.grant_type = Constants.OAUTH.GRANT_TYPE; this.scope = Constants.OAUTH.SCOPE; @@ -124,7 +123,7 @@ class OAuth extends EventEmitter { /** * Gets a new access token using a refresh token. - * @returns {object.<{ credentials: { access_token: string; refresh_token: string; expires: Date }; status: string }>} + * @returns {Promise.<{ credentials: { access_token: string; refresh_token: string; expires: Date }; status: string }>} */ async refreshAccessToken() { const identity = await this.#getClientIdentity(); @@ -178,7 +177,7 @@ class OAuth extends EventEmitter { // Here we download the script and extract the necessary data to proceed with the auth flow. const url_body = this.auth_script_regex.exec(yttv_response.data)[1]; const script_url = `${Constants.URLS.YT_BASE_URL}/${url_body}`; - + const response = await Axios.get(script_url, Constants.DEFAULT_HEADERS).catch((error) => error); if (response instanceof Error) throw new Error(`Could not extract client identity: ${response.message}`); @@ -197,4 +196,4 @@ class OAuth extends EventEmitter { } } -module.exports = OAuth; \ No newline at end of file +module.exports = OAuth;