backstage: GitHub login not working, no auth provider registered

We have 2 auth provider configured Guest and Github.

We are getting the below exception with Github auth provider

{“error”:{“name”:“NotFoundError”,“message”:“Auth provider registered for ‘github’ is misconfigured. This could mean the configs under auth.providers.github are missing or the environment variables used are not defined. Check the auth backend plugin logs when the backend starts to see more details.”,“stack”:"NotFoundError: Auth provider registered for ‘github’ is misconfigured. This could mean the configs under auth.providers.github are missing or the environment variables used are not defined. Check the auth backend plugin logs when the backend starts to see more details.\n at

Github should open the redirect url for authentication

Updated App-config.yaml file

Section Integration and Auth as below

auth: providers: github: development: clientId: $env: AUTH_GITHUB_CLIENT_ID clientSecret: $env: AUTH_GITHUB_CLIENT_SECRET production: clientId: $env: AUTH_GITHUB_CLIENT_ID clientSecret: $env: AUTH_GITHUB_CLIENT_SECRET

integrations: github: - host: github.com apps: - $include: github-app-credentials.yaml

  1. Start backstage
  2. Got to login screen, click on Github auth
  3. Exception screen pop up pointing to localhost:7000/api/auth/github URL

Context

We are not able to standup and import custom templates to our environment.

Note the same exception is observed during importing templates.

Your Environment

  • Browser Information:

  • Output of yarn backstage-cli info:


About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 24 (9 by maintainers)

Most upvoted comments

I have followed this discussion and tried everything… but still getting this error {"error":{"name":"NotFoundError","message":"No auth provider registered for 'github'","stack":"NotFoundError: No auth provider registered for 'github'\n at /workspace/backstagePOC/backstage-tutorial/node_modules/@backstage/plugin-auth-backend/dist/index.cjs.js:3541:15\n at handleReturn (/workspace/backstagePOC/backstage-tutorial/node_modules/express-promise-router/lib/express-promise-router.js:24:23)\n at /workspace/backstagePOC/backstage-tutorial/node_modules/express-promise-router/lib/express-promise-router.js:64:7\n at Layer.handle [as handle_request] (/workspace/backstagePOC/backstage-tutorial/node_modules/express/lib/router/layer.js:95:5)\n at trim_prefix (/workspace/backstagePOC/backstage-tutorial/node_modules/express/lib/router/index.js:328:13)\n at /workspace/backstagePOC/backstage-tutorial/node_modules/express/lib/router/index.js:286:9\n at Function.process_params (/workspace/backstagePOC/backstage-tutorial/node_modules/express/lib/router/index.js:346:12)\n at next (/workspace/backstagePOC/backstage-tutorial/node_modules/express/lib/router/index.js:280:10)\n at jsonParser (/workspace/backstagePOC/backstage-tutorial/node_modules/body-parser/lib/types/json.js:110:7)\n at handleReturn (/workspace/backstagePOC/backstage-tutorial/node_modules/express-promise-router/lib/express-promise-router.js:24:23)\n at jsonParser (/workspace/backstagePOC/backstage-tutorial/node_modules/express-promise-router/lib/express-promise-router.js:64:7)\n at Layer.handle [as handle_request] (/workspace/backstagePOC/backstage-tutorial/node_modules/express/lib/router/layer.js:95:5)\n at trim_prefix (/workspace/backstagePOC/backstage-tutorial/node_modules/express/lib/router/index.js:328:13)\n at /workspace/backstagePOC/backstage-tutorial/node_modules/express/lib/router/index.js:286:9\n at Function.process_params (/workspace/backstagePOC/backstage-tutorial/node_modules/express/lib/router/index.js:346:12)\n at next (/workspace/backstagePOC/backstage-tutorial/node_modules/express/lib/router/index.js:280:10)"},"request":{"method":"GET","url":"/api/auth/github/start?scope=read%3Auser%20repo&origin=https%3A%2F%2F3000-rapidxdevel-backstagepo-qgnhs2lefe6.ws-us93.gitpod.io&env=development"},"response":{"statusCode":404}} Any solution?

I have followed this discussion and tried everything… but still getting this error {"error":{"name":"NotFoundError","message":"No auth provider registered for 'github'","stack":"NotFoundError: No auth provider registered for 'github'\n at /workspace/backstagePOC/backstage-tutorial/node_modules/@backstage/plugin-auth-backend/dist/index.cjs.js:3541:15\n at handleReturn (/workspace/backstagePOC/backstage-tutorial/node_modules/express-promise-router/lib/express-promise-router.js:24:23)\n at /workspace/backstagePOC/backstage-tutorial/node_modules/express-promise-router/lib/express-promise-router.js:64:7\n at Layer.handle [as handle_request] (/workspace/backstagePOC/backstage-tutorial/node_modules/express/lib/router/layer.js:95:5)\n at trim_prefix (/workspace/backstagePOC/backstage-tutorial/node_modules/express/lib/router/index.js:328:13)\n at /workspace/backstagePOC/backstage-tutorial/node_modules/express/lib/router/index.js:286:9\n at Function.process_params (/workspace/backstagePOC/backstage-tutorial/node_modules/express/lib/router/index.js:346:12)\n at next (/workspace/backstagePOC/backstage-tutorial/node_modules/express/lib/router/index.js:280:10)\n at jsonParser (/workspace/backstagePOC/backstage-tutorial/node_modules/body-parser/lib/types/json.js:110:7)\n at handleReturn (/workspace/backstagePOC/backstage-tutorial/node_modules/express-promise-router/lib/express-promise-router.js:24:23)\n at jsonParser (/workspace/backstagePOC/backstage-tutorial/node_modules/express-promise-router/lib/express-promise-router.js:64:7)\n at Layer.handle [as handle_request] (/workspace/backstagePOC/backstage-tutorial/node_modules/express/lib/router/layer.js:95:5)\n at trim_prefix (/workspace/backstagePOC/backstage-tutorial/node_modules/express/lib/router/index.js:328:13)\n at /workspace/backstagePOC/backstage-tutorial/node_modules/express/lib/router/index.js:286:9\n at Function.process_params (/workspace/backstagePOC/backstage-tutorial/node_modules/express/lib/router/index.js:346:12)\n at next (/workspace/backstagePOC/backstage-tutorial/node_modules/express/lib/router/index.js:280:10)"},"request":{"method":"GET","url":"/api/auth/github/start?scope=read%3Auser%20repo&origin=https%3A%2F%2F3000-rapidxdevel-backstagepo-qgnhs2lefe6.ws-us93.gitpod.io&env=development"},"response":{"statusCode":404}} Any solution?

Any updates? I am facing the same issue, tried everything listed here.

@HieuMinh67 can you give a more detailed explanation of what worked for you? What does it mean that you “insert auth inside backend: in app-config.yaml”

Screen Shot 2022-08-17 at 19 39 19

Because there are 2 auth so I make a mistake

ref #11119 (comment)

@HieuMinh67 You can provide a auth provider like this

import {
  createRouter,
  providers,
} from '@backstage/plugin-auth-backend';

// ...

return await createRouter({
    logger: env.logger,
    config: env.config,
    database: env.database,
    discovery: env.discovery,
    tokenManager: env.tokenManager,
    providerFactories: {
      github: providers.github.create({
        signIn: {
          resolver(info, ctx) {
            const { profile } = info;
            const { displayName } = profile;
            const userRef = `user:default/${displayName}`; // Must be a full entity reference

            return ctx.issueToken({
              claims: {
                sub: userRef, // The user's own identity
                ent: [userRef], // A list of identities that the user claims ownership through
              },
            });
          }
        },
      }),
    }
  });

I have figured it out, I insert auth inside backend: in app-config.yaml

Ok and is the above file app-config.yaml?

And also what does your packages/backend/src/plugins/auth.ts look like?

Yes, above file app-config.yaml and I didn’t change packages/backend/src/plugins/auth.ts