a tool for shared writing and social publishing

fix handling oauth redirects to specifc subdomain

+5 -2
+5 -2
app/api/oauth/[route]/route.ts
··· 116 116 action: ActionAfterSignIn | null, 117 117 redirectPath: string, 118 118 ) => { 119 - let url = new URL(decodeURIComponent(redirectPath), "https://example.com"); 119 + let parsePath = decodeURIComponent(redirectPath); 120 + let url; 121 + if (parsePath.includes("://")) url = new URL(parsePath); 122 + else url = new URL(decodeURIComponent(redirectPath), "https://example.com"); 120 123 if (action?.action === "subscribe") { 121 124 let result = await subscribeToPublication(action.publication); 122 125 console.log(result); ··· 127 130 let path = url.pathname; 128 131 if (url.search) path += url.search; 129 132 if (url.hash) path += url.hash; 130 - return redirect(path); 133 + return parsePath.includes("://") ? redirect(url.toString()) : redirect(path); 131 134 };