Implementation of Social Authentication

Problem in github authentication

on auth/github gives
Error: Unknown authentication strategy "github"

The description of the lesson states:

Strategies with OAuth require you to have at least a Client ID and a Client Secret which is a way for them to verify who the authentication request is coming from and if it is valid. These are obtained from the site you are trying to implement authentication with, such as GitHub, and are unique to your app- THEY ARE NOT TO BE SHARED and should never be uploaded to a public repository or written directly in your code. A common practice is to put them in your .env file and reference them like: process.env.GITHUB_CLIENT_ID . For this challenge we’re going to use the GitHub strategy.

Obtaining your Client ID and Secret from GitHub is done in your account profile settings under ‘developer settings’, then ‘OAuth applications’. Click ‘Register a new application’, name your app, paste in the url to your glitch homepage ( Not the project code’s url ), and lastly for the callback url, paste in the same url as the homepage but with ‘/auth/github/callback’ added on. This is where users will be redirected to for us to handle after authenticating on GitHub. Save the returned information as ‘GITHUB_CLIENT_ID’ and ‘GITHUB_CLIENT_SECRET’ in your .env file.

You .env seems to be empty.

1 Like

I looked at fcc repo I found the issue , even though we have different routers and auth folder we need to add all the routes and authentication back to server.js for making authentication to work

1 Like

I just got the same error and realized that I forgot to add the auth(app, myDataBase) call in the following:

myDB(async client => {
  const myDataBase = await client.db('database').collection('users');
  routes(app, myDataBase)
  auth(app, myDataBase)
}).catch(e => {

So, does it mean, that we actually have to copy the same codes that we have in routes.js & auth.js files to the server.js? Why we then creating the separate js files?