Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/auth/google 404 Not Found #574

Closed
travisstaloch opened this Issue Sep 19, 2017 · 1 comment

Comments

Projects
None yet
1 participant
@travisstaloch
Copy link

travisstaloch commented Sep 19, 2017

Steps to reproduce

  • feathers generate app with rest and sockets
  • feathers generate authentication select google, facebook, and local
  • fill out default.json configuration with mongodb connection and google/facebook clientID/secrets
  • tested users.create and feathers.authenticate({strategy: 'local'}) in client is working
  • started working on google signin and discovered that /auth/google and /auth/facebook are 404 not found. not found at /users/auth/... or /authentication/... either

Expected behavior

the routes should exist

Actual behavior

the routes are not found

System configuration

package.json

...
"dependencies": {
    "body-parser": "^1.18.1",
    "compression": "^1.7.0",
    "feathers": "^2.2.0",
    "feathers-authentication": "^1.2.7",
    "feathers-authentication-hooks": "^0.1.4",
    "feathers-authentication-jwt": "^0.3.2",
    "feathers-authentication-local": "^0.4.4",
    "feathers-authentication-oauth2": "^0.2.6",
    "feathers-configuration": "^0.4.1",
    "feathers-errors": "^2.9.2",
    "feathers-hooks": "^2.0.2",
    "feathers-hooks-common": "^3.7.3",
    "feathers-mongodb": "^2.9.0",
    "feathers-rest": "^1.8.0",
    "feathers-socketio": "^2.0.0",
    "helmet": "^3.8.1",
    "mongodb": "^2.2.31",
    "passport-facebook": "^2.1.1",
    "passport-google-oauth20": "^1.0.0",
...
}
...

Tell us about the applicable parts of your setup.
config/default.json

...
  "authentication": {
    "secret": "...",
    "strategies": ["jwt", "local"],
    "path": "/authentication",
    "service": "users",
    "jwt": {
      "header": {
        "type": "access"
      },
      "audience": "https://yourdomain.com",
      "subject": "anonymous",
      "issuer": "feathers",
      "algorithm": "HS256",
      "expiresIn": "1d"
    },
    "local": {
      "entity": "user",
      "usernameField": "email",
      "passwordField": "password"
    },
    "google": {
      "clientID": "...",
      "clientSecret": "...",
      "successRedirect": "/",
      "scope": ["profile email"]
    },
...

NodeJS version:
v6.11.1
Operating System:
windows 10
Browser Version:
chrome

I've tried debug logging with winston but it only shows this right now which i don't believe is related to this 404 problem:

info: error: authentication - Method: create: Missing credentials
debug: hook.data strategy=local
debug: hook.params , provider=socketio, , ,
error: BadRequest: Missing credentials
at Error.BadRequest (C:\Users\Travis\Documents\Code\Projects\vuthers3\node_modules\feathers-errors\lib\index.js:93:17)
at C:\Users\Travis\Documents\Code\Projects\vuthers3\node_modules\feathers-authentication\lib\hooks\authenticate.js:102:31
at process._tickDomainCallback (internal/process/next_tick.js:135:7)
info: (404) Route: /auth/google - Page not found

Really appreciate any advice. Thank you.

@travisstaloch

This comment has been minimized.

Copy link
Author

travisstaloch commented Sep 19, 2017

After removing feathers notFound() and handler() middlewares from src/middleware/index.js, and using one of my own, I was able to discover that this was an error with my google oauth2 configuration which was being hidden by feathers. I was able to get it working after adding localhost:3030/auth/google/callback to the list of allowed redirect URIs.

  // app.use(notFound())
  // app.use(logger(app))
  // app.use(handler())
  function errorHandler(err, req, res, next) {
    res.status(500)
    res.render('error', { error: err })
  }
  app.use(errorHandler)

Somehow this allowed me to see the error message returned by google. Still not sure why other than I prevented the notFound page from showing up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.