summary refs log tree commit diff
path: root/src/connections/Twitch
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2023-01-24 18:15:26 +1100
committerPuyodead1 <puyodead@proton.me>2023-03-18 19:33:32 -0400
commitc7277efbad5d3979222518ae543366ba8a08ca77 (patch)
tree89f9815b7c2a66908874eb0f2eb678aeb0211a96 /src/connections/Twitch
parentCheck visibility for connected accounts in /users/:id/profile (diff)
downloadserver-c7277efbad5d3979222518ae543366ba8a08ca77.tar.xz
Move redirect uri generation to getRedirectUri function of Connection class.
Use api_endpointPublic instead of cdn_endpointPublic
Diffstat (limited to 'src/connections/Twitch')
-rw-r--r--src/connections/Twitch/index.ts14
1 files changed, 2 insertions, 12 deletions
diff --git a/src/connections/Twitch/index.ts b/src/connections/Twitch/index.ts
index 264db3cc..7cc88caa 100644
--- a/src/connections/Twitch/index.ts
+++ b/src/connections/Twitch/index.ts
@@ -1,5 +1,4 @@
 import {
-	Config,
 	ConnectedAccount,
 	ConnectedAccountCommonOAuthTokenResponse,
 	ConnectionCallbackSchema,
@@ -49,13 +48,7 @@ export default class TwitchConnection extends RefreshableConnection {
 		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);
@@ -85,10 +78,7 @@ export default class TwitchConnection extends RefreshableConnection {
 					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()