0
votes

I want to setup the Github OAuth on the rest server API,

I have generated My Client ID and Secret from GitHub account, also set up the environment variable Like:

export COMPOSER_PROVIDERS='{
  "github": {
    "provider": "github",
    "module": "passport-github",
    "clientID": "ID",                    
    "clientSecret": "SECRET",               
    "authPath": "/auth/github",
    "callbackURL": "/auth/github/callback",
    "successRedirect": "/",
    "failureRedirect": "/"
  }
}'

Also setup in the /etc/environment file

But While I am trying to verify using http://localhost:3000/auth/github This shows me the error.

{"error":{"statusCode":404,"name":"Error","message":"Cannot GET /auth/github","status":404,"stack":"Error: Cannot GET /auth/github\n at raiseUrlNotFoundError (/home/test/.nvm/versions/node/v8.10.0/lib/node_modules/composer-rest-server/node_modules/loopback/server/middleware/url-not-found.js:21:17)\n at Layer.handle [as handle_request] (/home/test/.nvm/versions/node/v8.10.0/lib/node_modules/composer-rest- .........

Can anyone please help on the same.

1

1 Answers

0
votes

Just to check did you replace the values below with the secret and ID?

"clientID": "[idshouldgohere]",                    
"clientSecret": "[secretshouldgohere]", 

If this was done and you are still getting the error, check that in github that you have the correct redirect to wherever the url is on your local.