Skip to content

userInfo.sub undefined from github Oauth2 #133

@alborotogarcia

Description

@alborotogarcia

Describe the bug
sub field from userInfo is always undefined

To Reproduce
By using github oauth provider I always get

GET /api/app/oauth/authorization/github 302 in 15ms
[09:09:11] ERROR: Failed query: select count() from "app_user_accounts" where "app_user_accounts"."sub" = ?
params:
err: {
"type": "DrizzleQueryError",
"message": "Failed query: select count(
) from "app_user_accounts" where "app_user_accounts"."sub" = ?\nparams: : undefined cannot be passed as argument to the database",
"stack":
Error: Failed query: select count(*) from "app_user_accounts" where "app_user_accounts"."sub" = ?
params:

Expected behavior
Setting in oauth2_callback sub as
sub: userInfo.sub ?? userInfo.id?.toString(),

might solve it

Screenshots
looking at the full userInfo object response

Image

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions