Skip to content

Clicking "Login with Google" on the admin dashboard navigates to an incorrect URL #1671

Closed

Description

@segmentationfaulter

Description

When a Google OAuth provider is configured and the user clicks "Login with Google" on the admin login page, the browser is redirected to an incorrect URL with a duplicated path segment, resulting in a 404 error.

The login button at /_emdash/admin links to /_emdash/admin/_emdash/api/auth/oauth/google instead of /_emdash/api/auth/oauth/google.

Steps to reproduce

  1. Configure Google as an OAuth auth provider in the EmDash integration config
  2. Set EMDASH_OAUTH_GOOGLE_CLIENT_ID and EMDASH_OAUTH_GOOGLE_CLIENT_SECRET
  3. Navigate to /_emdash/admin
  4. Click the "Login with Google" button

Expected: Browser navigates to /_emdash/api/auth/oauth/google

Actual: Browser navigates to /_emdash/admin/_emdash/api/auth/oauth/google (double _emdash in path), resulting in a 404

Environment

  • emdsash version: 0.25.1
  • Runtime: Cloudflare workers
  • OS: MacOS

Logs / error output

Activity

  1. added
    bug
    on Jun 30, 2026
  2. added theissue type on Jul 9, 2026
  3. masonjames commented on Jul 9, 2026

    @masonjames
    Contributor

    Confirmed from a real deployed EmDash admin/OAuth flow.

    I tested this against a production site with Google and GitHub OAuth providers configured. The issue is in the admin login provider link routing: OAuth provider URLs must leave the admin SPA and go to /_emdash/api/auth/oauth/{provider}, not be treated as admin-router links under /_emdash/admin.

    Verification notes:

    • A pre-fix check of the admin routing behavior showed the non-admin /_emdash/api/auth/oauth/google path was not protected from admin basepath handling.
    • With the PR-equivalent fix deployed, the login page renders the Google provider link as /_emdash/api/auth/oauth/google.
    • Google starts at https://accounts.google.com/o/oauth2/v2/auth.
    • GitHub starts at https://github.com/login/oauth/authorize.
    • After adding the production Google callback URI, Google login completes successfully for the existing Mason James admin user.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/adminarea/authbug

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions