Skip to content

user object is undefined inside signIn callback of auth.js provider #8237

Open
@xoldd

Description

@xoldd

Environment

OS: Linux 6.4 Fedora Linux 38 (Workstation Edition)
Node: 18.17.0
Brave Browser: 115.1.56.20

Reproduction URL

https://codesandbox.io/p/sandbox/authjs-solidjs-hd4x9n

Describe the issue

In auth.js package the user object received as prop in signIn callback is undefined. This means we can't do custom checks on the user signing up or logging in, or mutate the user object for a client that is signing in for the first time(signing up), for example a populating a required database field with randomly generated value.

How to reproduce

Go to this link:- https://codesandbox.io/p/sandbox/authjs-solidjs-hd4x9n

Do the setup and all that. You will need to populate github client id and secret in .env file. After that click the sign in button and check the console. User object will be undefined.

Expected behavior

Go to this link:- https://codesandbox.io/p/sandbox/next-auth-nextjs-kwkj6s

Same thing as above but this time user object is logged normally and it isn't undefined.

So ultimately the next-auth package works while auth.js package doesn't.

Metadata

Metadata

Assignees

No one assigned

    Labels

    solidjstriageUnseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions