How to retrieve Microsoft Entra ID oid
in session user object?
#13005
Unanswered
Ludovicli973
asked this question in
Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello everyone,
I'm using Authjs with the
microsoft-entra-id
provider in a Next.js 15 project using App Router. Here's my current setup:When I fetch the session in a Server Component:
The problem is: I don't get the oid (user ID from Microsoft) in the session object
I've tried to inspect the session.user, but oid is not included, no id field either, I need the oid field to store a unique identifier in my database (as the user ID). I also tried adding a custom profile() method in the provider config to include the oid, but when I do that, I lose the image (user picture) from the session, which is weird, and i can't even access id either.
I still don't see the id in session.user So how can I properly include the Microsoft Entra oid in the session without losing the default user fields like image
Thanks in advance for your help 🙏
Beta Was this translation helpful? Give feedback.
All reactions