Skip to content

Header Login and Register buttons ignore the login and register route roles #305

Closed

Description

@arbrandes

Description

The shell header's Login and Register buttons link straight to LMS URLs taken from site config, ignoring the org.openedx.frontend.role.login and org.openedx.frontend.role.register route roles. When @openedx/frontend-app-authn is installed as an app, clicking Login in the header still sends the user off to the legacy LMS login page instead of navigating to the Authn app's /authn/login route.

LoginButton renders href={config.loginUrl} in shell/header/anonymous-menu/LoginButton.tsx, and RegisterButton builds ${config.lmsBaseUrl}/register in shell/header/anonymous-menu/RegisterButton.tsx. Neither consults the routes registered by the apps in the site config.

This is inconsistent with the rest of the runtime. runtime/routing/authenticatedLoader.ts resolves the login destination with getUrlByRouteRole() first and only falls back to config.loginUrl when no app provides that role, which is why a redirect from a protected route correctly lands on the Authn app while the header button does not.

An LMS-side redirect can mask the problem, since /login redirects to AUTHN_MICROFRONTEND_URL when ENABLE_AUTHN_MICROFRONTEND is enabled. That is still a full page round trip out to the LMS and back rather than an in-app navigation, and it fails outright on deployments where the redirect is not configured.

Proposed solution

Make both buttons role-aware, preserving the current site config values as fallbacks so behavior is unchanged for sites that do not install the Authn app. LoginButton should use getUrlByRouteRole('org.openedx.frontend.role.login') and fall back to config.loginUrl; RegisterButton should use getUrlByRouteRole('org.openedx.frontend.role.register') and fall back to ${config.lmsBaseUrl}/register.

Because a resolved role URL can be either an internal path or an external route URL, the buttons should also navigate internally when the resolved value is a relative path, so that the SPA handles it rather than triggering a full page load. The same treatment likely applies anywhere else in the shell that links to authentication destinations.

LLM usage notice

Built with assistance from Claude.

Activity

  1. added theissue type on Aug 29, 2026
  2. self-assigned this
    on Aug 29, 2026
  3. added a commit that references this issue on Aug 29, 2026
    ea6b81c
  4. moved this from Todo to Done in frontend-baseon Aug 29, 2026
  5. openedx-semantic-release-bot commented on Aug 29, 2026

    @openedx-semantic-release-bot

    🎉 This issue has been resolved in version 2.0.0-alpha.9 🎉

    The release is available on:

    Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions