30daysofnode icon indicating copy to clipboard operation
30daysofnode copied to clipboard

day 30: missing client_id field in /github/auth

Open ifwatts opened this issue 5 years ago • 0 comments

Code below needs to also pass in config.client_id as it is mandatory

app.get('/github/auth', function(req,res){
   // redirect the user to github authorization url
   return res.redirect(config.authorize_url);
});

I have changed my sample to be like..

app.get('/github/auth', function(req,res){
  // redirect the user to github authorization url
  console.log("In github/auth , redirecting to " + client.redirect_url );
  return res.redirect(`${config.authorize_url}?client_id=${config.client_id}?redirect_url=${client.redirect_url}`);
});

This is based on the github documentation here https://developer.github.com/enterprise/2.19/apps/building-oauth-apps/authorizing-oauth-apps/#web-application-flow which calls out that client_id is mandatory

ifwatts avatar Jun 23 '20 21:06 ifwatts