Get a users id (snowflake) when signing in 0Auth
I am using the create-t3-app setup with nextAuth, prisma and tRPC
After setting up the Discord env variables and making my login page, it seems that the
id
in the user
field of the session data isn't my "actual" Discord ID
It is clf2f3yvh0000v07off4kpi78
rather than 843312530528796697
I need access to this number because I want to only let certain ID's access the app.
I plan on using this to check with Discord's API if the user has a certain role in a certain discord before allowing them on the site, but without access to this number I don't see how this would be possible
I haven't made any changes to the server auth code yet, only UI stuff
Does anyone have any advice?2 Replies
if memory serves me right
user.id
will return the id that's been set in whatever DB prisma is linked to while what you want would be returned by profile.id
you are right
i didnt actually need prisma for my app (just yet anyway) so i am removing it
also didn't know you could overwrite the
signIn
callback in the authOptions, and that lets me do exactly what i need with the users profile