From ae195d917065efee0f9e075e6e43fd40de882a09 Mon Sep 17 00:00:00 2001 From: Amaury Date: Tue, 27 Jul 2021 18:33:53 +0200 Subject: [PATCH] Fix b2b04df23b850f596e604c0acdf474eba2da320b requestAuthToken was set to async but he wasn't waited for his usage. --- lib/peertubeRequester.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/peertubeRequester.ts b/lib/peertubeRequester.ts index a2c2cbf..9e58271 100644 --- a/lib/peertubeRequester.ts +++ b/lib/peertubeRequester.ts @@ -27,7 +27,7 @@ class PeerTubeRequester { this.password = config.password; } - private async requestAuthToken(): Promise { + private async requestAuthToken(): Promise { let response = await fetch( new URL(`/api/v1/oauth-clients/local`, this.domain_name) ); @@ -60,7 +60,7 @@ class PeerTubeRequester { } async uploadFromUrl(message: UploadInstruction): Promise { - const accessToken = this.requestAuthToken(); + const accessToken = await this.requestAuthToken(); const myUploadForm = new URLSearchParams(); const myHeader = new Headers(); myHeader.append("Authorization", `Bearer ${accessToken}`);