{"record":{"id":"b75d4464a64930b1","repo":"medusajs/medusa","slug":"github-does-not-support-registration-use-method","errorCode":null,"errorMessage":"Github does not support registration. Use method `authenticate` instead.","messagePattern":"Github does not support registration\\. Use method `authenticate` instead\\.","errorType":"http","errorClass":"MedusaError","httpStatus":405,"severity":"error","filePath":"packages/modules/providers/auth-github/src/services/github.ts","lineNumber":52,"sourceCode":"    }\n\n    if (!options.callbackUrl) {\n      throw new Error(\"Github callbackUrl is required\")\n    }\n  }\n\n  constructor(\n    { logger }: InjectedDependencies,\n    options: GithubAuthProviderOptions\n  ) {\n    // @ts-ignore\n    super(...arguments)\n    this.config_ = options\n    this.logger_ = logger\n  }\n\n  async register(_): Promise<AuthenticationResponse> {\n    throw new MedusaError(\n      MedusaError.Types.NOT_ALLOWED,\n      \"Github does not support registration. Use method `authenticate` instead.\"\n    )\n  }\n\n  async authenticate(\n    req: AuthenticationInput,\n    authIdentityService: AuthIdentityProviderService\n  ): Promise<AuthenticationResponse> {\n    const query: Record<string, string> = req.query ?? {}\n    const body: Record<string, string> = req.body ?? {}\n\n    if (query.error) {\n      return {\n        success: false,\n        error: `${query.error_description}, read more at: ${query.error_uri}`,\n      }\n    }","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/medusajs/medusa/blob/5e06e544a296b9033f20f71f11c559f81a0e5739/packages/modules/providers/auth-github/src/services/github.ts#L34-L70","documentation":"Github's OAuth flow only supports sign-in (authenticate), not sign-up. Calling `register` on the Github auth provider always throws a NOT_ALLOWED MedusaError by design, since Github has no registration endpoint to drive.","triggerScenarios":"A client POSTing to `/auth/customer/github/register` or calling `authProvider.register(...)` directly.","commonSituations":"Building a unified sign-up form that routes all providers through register, or assuming all auth providers implement both methods.","solutions":["Route Github sign-ins through the authenticate endpoint (`/auth/github/github/authenticate`) instead of register","In shared UI, hide the register step for OAuth providers and call authenticate directly"],"exampleFix":"// before\nawait sdk.auth.register('customer', 'github', { /* ... */ })\n// after\nawait sdk.auth.authenticate('customer', 'github', {}) // redirects to Github OAuth","handlingStrategy":"try-catch","validationCode":"const supportsRegister = (providerId: string) => !['github', 'google'].includes(providerId)","typeGuard":null,"tryCatchPattern":"try { await provider.register(payload) } catch (e) { if (e.type === 'not_allowed') { /* route to authenticate instead */ } else throw e }","preventionTips":["Branch sign-up vs sign-in by provider type in the client","Treat OAuth providers as authenticate-only by convention"],"tags":["github","oauth","not-allowed","auth-provider"],"backgroundTag":"oauth-unsupported-operation","analyzedSha":"5e06e544a296b9033f20f71f11c559f81a0e5739","analyzedAt":"2026-08-27T07:24:39.599Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}