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

Broken authentication #3276

Closed
jpoles1 opened this issue Sep 16, 2023 · 1 comment · Fixed by #3284
Closed

Broken authentication #3276

jpoles1 opened this issue Sep 16, 2023 · 1 comment · Fixed by #3284

Comments

@jpoles1
Copy link

jpoles1 commented Sep 16, 2023

Steps to reproduce

Logging in using Google Oauth as per: https://feathersjs.com/cookbook/authentication/google.html

Was previously working fine (for ~1 year), but went back and made some changes to the code, rebuilt the project and now this bug is coming up.

Login intermittently fails with cryptic error: "Right hand side of instanceof is not an object". Had to jump into debugger to find the root of the issue.

Appears to result from an undefined value being passed as params.secret to createAccessToken under the create function in @feathersjs/authentication/lib/service.js (line 93).

I have been unable to trace the error any further. I think my config is setup correctly (note: * used to omit sensitive info):

{
  "host": "localhost",
  "port": 5000,
  "public": "../*/dist",
  "apiPath": "/api",
  "paginate": {
    "default": 250,
    "max": 5000
  },
  "authentication": {
    "entity": "user",
    "service": "users",
    "secret": "srK8eAnUbb9vtVAji/abZCCAfmI=",
    "authStrategies": [
      "jwt",
      "local",
      "google"
    ],
    "jwtOptions": {
      "header": {
        "typ": "access"
      },
      "audience": "https://*.app",
      "issuer": "feathers",
      "algorithm": "HS256",
      "expiresIn": "42d"
    },
    "local": {
      "usernameField": "email",
      "passwordField": "password"
    },
    "oauth": {
      "redirect": "http://localhost:8080/login?",
      "google": {
        "key": "*",
        "secret": "*",
        "scope": [
          "email",
          "profile",
          "openid"
        ],
        "nonce": true
      }
    }
  },
  "mongodb": "mongodb://localhost:27017/*"
}

Expected behavior

Should allow me to login.

Actual behavior

Fails to login using Google Oauth. Gives error "Right hand side of instanceof is not an object"

Unclear why. Previously occuring only sporadic on both my local and production server. Then became permanent on my prod server rendering me unable to login, then on my dev server too. Not sure but suspect this may have come from updated feathers dependencies?

System configuration

Tell us about the applicable parts of your setup.

Module versions (especially the part that's not working):

NodeJS version:

Operating System:

Browser Version:

React Native Version:

Module Loader:

@jpoles1
Copy link
Author

jpoles1 commented Sep 16, 2023

Brute force, but I seem to have fixed it by downgrading to feathers 4.5.11:

    "@feathersjs/authentication": "4.5.11",
    "@feathersjs/authentication-local": "4.5.11",
    "@feathersjs/authentication-oauth": "4.5.11",
    "@feathersjs/configuration": "4.5.11",
    "@feathersjs/errors": "4.5.11",
    "@feathersjs/express": "4.5.11",
    "@feathersjs/feathers": "4.5.11",
    "@feathersjs/socketio": "4.5.11",
    "@feathersjs/transport-commons": "4.5.11",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant