Skip to content

GitHub device flow fails — clientId missing from auth discovery #157

Closed
yohaann196/emdash
#2

Description

@benbartling

Bug

emdash plugin login fails with a 404 on the GitHub device authorization flow.

Fetching auth configuration...

ERROR  GitHub device flow failed: 404

    at authenticateViaDeviceFlow (node_modules/emdash/dist/cli/index.mjs:2855:27)

Root Cause

The marketplace discovery endpoint (GET https://marketplace.emdashcms.com/api/v1/auth/discovery) returns:

{
  "github": {
    "deviceAuthorizationEndpoint": "https://github.com/login/device/code",
    "tokenEndpoint": "https://github.com/login/oauth/access_token"
  },
  "marketplace": {
    "deviceTokenEndpoint": "/api/v1/auth/github/device"
  }
}

The github.clientId field is missing from this response.

In cli/commands/publish.ts, authenticateViaDeviceFlow reads discovery.github.clientId and passes it as client_id to GitHub's device authorization endpoint. Since the field is absent, client_id is undefined, and GitHub returns a 404.

Expected Behavior

The discovery response should include github.clientId so the device flow can proceed:

{
  "github": {
    "clientId": "<GitHub OAuth App client ID>",
    "deviceAuthorizationEndpoint": "https://github.com/login/device/code",
    "tokenEndpoint": "https://github.com/login/oauth/access_token"
  }
}

Steps to reproduce

emdash plugin login

Environment

emdash 0.0.1

Activity

  1. added
    bug
    on Apr 3, 2026
  2. yohaann196 commented on Apr 4, 2026

    @yohaann196
    Contributor

    fixed in #251

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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions