From c7277efbad5d3979222518ae543366ba8a08ca77 Mon Sep 17 00:00:00 2001 From: Madeline <46743919+MaddyUnderStars@users.noreply.github.com> Date: Tue, 24 Jan 2023 18:15:26 +1100 Subject: Move redirect uri generation to getRedirectUri function of Connection class. Use api_endpointPublic instead of cdn_endpointPublic --- src/connections/Youtube/index.ts | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'src/connections/Youtube') diff --git a/src/connections/Youtube/index.ts b/src/connections/Youtube/index.ts index afc9356b..9fa8eb38 100644 --- a/src/connections/Youtube/index.ts +++ b/src/connections/Youtube/index.ts @@ -1,5 +1,4 @@ import { - Config, ConnectedAccount, ConnectedAccountCommonOAuthTokenResponse, ConnectionCallbackSchema, @@ -56,13 +55,7 @@ export default class YoutubeConnection extends Connection { const url = new URL(this.authorizeUrl); url.searchParams.append("client_id", this.settings.clientId!); - // TODO: probably shouldn't rely on cdn as this could be different from what we actually want. we should have an api endpoint setting. - url.searchParams.append( - "redirect_uri", - `${ - Config.get().cdn.endpointPrivate || "http://localhost:3001" - }/connections/${this.id}/callback`, - ); + url.searchParams.append("redirect_uri", this.getRedirectUri()); url.searchParams.append("response_type", "code"); url.searchParams.append("scope", this.scopes.join(" ")); url.searchParams.append("state", state); @@ -92,10 +85,7 @@ export default class YoutubeConnection extends Connection { code: code, client_id: this.settings.clientId!, client_secret: this.settings.clientSecret!, - redirect_uri: `${ - Config.get().cdn.endpointPrivate || - "http://localhost:3001" - }/connections/${this.id}/callback`, + redirect_uri: this.getRedirectUri(), }), ) .post() -- cgit 1.4.1