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

Oauth Issue using feathers-chat-app V5 #3456

Open
chrisbag opened this issue Apr 8, 2024 · 2 comments
Open

Oauth Issue using feathers-chat-app V5 #3456

chrisbag opened this issue Apr 8, 2024 · 2 comments

Comments

@chrisbag
Copy link

chrisbag commented Apr 8, 2024

Steps to reproduce

  1. Get feathers-chat sample app https://github.com/feathersjs/feathers-chat
  2. Try using github oauth or google oauth (I've tested both)
  3. The oauth page of the provider opens, the authentication with the provider is successfull
  4. The app is redirected and there is an error in the params

TypeError: Cannot read properties of undefined (reading 'sub')

image

It appears that some other people have also experienced this issue. Is this a bug with the @feathersjs/authentication-oauth@5.0.0 or am I missing something in the config ?

thanks a lot for your help :)

Expected behavior

Should authenticate and return the logged in use

Actual behavior

Authentication failed and returns error message

System configuration

Tell us about the applicable parts of your setup.
Feathers v5

config/default.json

{
  "host": "localhost",
  "port": 3040,
  "public": "../public/",
  "origins": [
    "http://localhost:3040",
    "http://localhost:3000"
  ],
  "paginate": {
    "default": 10,
    "max": 50
  },
  "sqlite": {
    "client": "sqlite3",
    "connection": "feathers-chat.sqlite",
    "useNullAsDefault": true
  },
  "authentication": {
    "entity": "user",
    "service": "users",
    "secret": "VL59H5Mz4td/nR/oxTumJrwCKOgeltEZ",
    "authStrategies": [
      "jwt",
      "local",
      "google",
      "github,"
    ],
    "jwtOptions": {
      "header": {
        "typ": "access"
      },
      "audience": "http://localhost:3040",
      "algorithm": "HS256",
      "expiresIn": "1d"
    },
    "local": {
      "usernameField": "email",
      "passwordField": "password"
    },
    "oauth": {
      "defaults": {
        "origin": "http://localhost:3040",
      },
      "github": {
        "key": "github-id",
        "secret":"github-secret",
      },
      "google": {
        "key": "My-google-id-key",
        "secret": "my-google-id-secret",
        "scope": ["openid", "profile", "email"],
        "nonce": true,
      }
    }
  }
}

custom-environment-variables.json

{
  "port": {
    "__name": "PORT",
    "__format": "number"
  },
  "authentication": {
    "secret": "FEATHERS_SECRET"
  }
}
@ericuldall
Copy link

I think I'm being plagued by the same issue: #3465

Been digging a bit and I have a feathers v4 app that uses the same strategy and it works fine but one thing i did notice is it looks like my other app is using oauth2 v1 and my new app is using oauth2 v2.

Looks like i'm able to get the token when switching to the GSI button: https://developers.google.com/identity/gsi/web/guides/personalized-button

@RobMaple
Copy link

FWIW I just had this issue... turns out though it was simply because in my haste I'd been trying to login via the oAuth callback URL. Posting this in case it helps anyone else visitng this issue!

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

No branches or pull requests

3 participants