Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Admin UI error Auth redirect #3047

Merged
merged 4 commits into from
Nov 4, 2024
Merged

fix: Admin UI error Auth redirect #3047

merged 4 commits into from
Nov 4, 2024

Conversation

DarianM
Copy link
Member

@DarianM DarianM commented Oct 27, 2024

Changes proposed in this pull request

Using the Form with redirectDocument(loginUrl); By using remix's action function and redirectDocument instead of href, the server processes the request, retrieves the necessary information (such as flow parameters from Ory Kratos), and provides the correct redirect response. The form submit allows remix to handle this routing server-side, ensuring the full URL is correctly generated.

The href attribute instead tries to directly navigate to the link client-side. If variables.kratosBrowserPublicUrl is undefined or not available at runtime, Remix will interpret it as undefined, creating the localhost:3010/undefined/self-service/login/browser URL.

Context

What were you trying to do?
fixes #2840

Copy link

netlify bot commented Oct 27, 2024

Deploy Preview for brilliant-pasca-3e80ec canceled.

Name Link
🔨 Latest commit 3ea6a45
🔍 Latest deploy log https://app.netlify.com/sites/brilliant-pasca-3e80ec/deploys/6728abddff018200081e0efd

@DarianM DarianM changed the title change href with redirectDocument fix: Admin UI error Auth redirect Oct 27, 2024
@DarianM DarianM requested a review from JoblersTune October 31, 2024 16:48
mkurapov
mkurapov previously approved these changes Oct 31, 2024
packages/frontend/app/routes/auth._index.tsx Outdated Show resolved Hide resolved
mkurapov
mkurapov previously approved these changes Nov 1, 2024
Login
</Button>
<Form method='post'>
<Button aria-label='logout' type='submit' className='mr-2'>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<Button aria-label='logout' type='submit' className='mr-2'>
<Button aria-label='login' type='submit' className='mr-2'>

@JoblersTune
Copy link
Collaborator

@DarianM thanks for the fix! Would you mind please moving the action function below the default export function to match the styling throughout the frontend codebase. We usually stick to loader, then default export, and then action function below that.

@DarianM DarianM merged commit 8651fe5 into main Nov 4, 2024
30 of 42 checks passed
@DarianM DarianM deleted the 2840-bug-admin-ui-error branch November 4, 2024 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: frontend Changes in the frontend package.
Projects
None yet
3 participants