refactor(auth): remove redirect_uri parameter from OAuth flow

Simplify OAuth login and account linking by removing the redirect_uri
parameter from initiateLogin and initiateLink functions. The backend
now handles callback URL construction internally.
This commit is contained in:
2026-04-06 23:50:42 +09:30
parent 11f56c187f
commit f653ee5ca7
3 changed files with 3 additions and 14 deletions
-5
View File
@@ -512,14 +512,9 @@ export default function LoginPage() {
setIsLoading(true);
try {
// The redirect_uri Google will call is the *backend* callback.
// The backend then redirects to the frontend /oauth/callback with the token.
const backendCallbackUri = `${import.meta.env.VITE_API_BASE_URL ?? 'http://localhost:5000/api/v1'}/auth/external/${provider}/callback`;
// Ask backend for the Google authorization URL
// If we're in an OIDC bridge flow, pass oidc_session_id so it survives the round-trip
const response = await api.externalAuth.initiateLogin(provider, {
redirect_uri: backendCallbackUri,
flow: 'login',
...(oidcSessionId ? { oidc_session_id: oidcSessionId } : {}),
});
+1 -5
View File
@@ -88,11 +88,7 @@ export default function LinkedAccountsPage() {
setIsLinking(provider);
try {
// The backend link flow also redirects to the backend callback, which
// then redirects to the frontend /oauth/callback with flow=link.
const backendCallbackUri = `${import.meta.env.VITE_API_BASE_URL ?? 'http://localhost:5000/api/v1'}/auth/external/${provider}/callback`;
const response = await api.externalAuth.initiateLink(provider, backendCallbackUri);
const response = await api.externalAuth.initiateLink(provider);
// Redirect to authorization
window.location.href = response.authorization_url;