Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Refactor OAuth URL generation in Stripe app

Kiran K40773ca97d7e
diff --git a/packages/stripe-app/src/utils/oauth.ts b/packages/stripe-app/src/utils/oauth.ts
index 422340e449..ed9ccb5617 100644
--- a/packages/stripe-app/src/utils/oauth.ts
+++ b/packages/stripe-app/src/utils/oauth.ts
@@ -16,7 +16,17 @@ export function getOAuthUrl({
state: string;
challenge: string;
}) {
- return `${DUB_HOST}/oauth/authorize?client_id=${DUB_CLIENT_ID}&redirect_uri=${STRIPE_REDIRECT_URL}&response_type=code&scope=workspaces.write&state=${state}&code_challenge=${challenge}&code_challenge_method=S256`;
+ const searchParams = {
+ client_id: DUB_CLIENT_ID,
+ redirect_uri: STRIPE_REDIRECT_URL,
+ response_type: "code",
+ code_challenge: challenge,
+ code_challenge_method: "S256",
+ scope: "workspaces.write",
+ state,
+ };
+
+ return `${DUB_HOST}/oauth/authorize?${new URLSearchParams(searchParams).toString()}`;
}
// Exchanges the authorization code for an access token