-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Profile photo not showing when logging in with Azure AD #439
Comments
We also have the same issue with our organization! |
Also looking for a resolution to this here thanks! |
If you working with Azurechat in an enterprise with AzureAD the photo is not exposed with the default user.read scope. You can add additional scopes, including ProfilePhoto.Read.All, to your implementation by modifying the next-auth configuration in auth-api.ts. Personally I have not done this with profile photos but I pass additional scopes to enrich default functions with calendar.read, bookmark.read.all, user.readbasic.all etc. Next-auth does not have built in token refresh logic so you will need to implement it manually if you want to use additional graph scopes. Happy to provide additional details if interested. You can also inspect the account, profile and user objects in the jwt callback to see if a profile photo value is returned in any of them and pass it to the session. |
@DakotaWray2 appreciate the input, thanks! I tried adding ProfilePhoto.Read.All as Delegated permission, granted ok, still same - no profile photo showing. I see in the next-auth azure-ad.js that its using this endpoint to fetch the profile photo: When testing this manually with Graph Explorer on same Azure AD, all is working, it fetches my profile photo in e.g. 48x48. |
I setup an app registration in Azure with delegated API permissions for "email, openid and profile", which is the same scope as defined in the project from node module next-auth (src/node_modules/next-auth/providers/azure-ad.js)
Login works fine, email and name is shown correct when logging in with Microsoft 365 login.
But no profile photo showing in e.g. chat and menu. I tried adding the "User.Read" permissions to the scope and API permissions, did not help (mentioned in MS docs as relevant permission to retrieve profile photo: https://learn.microsoft.com/en-us/graph/api/profilephoto-get?view=graph-rest-1.0&tabs=http)
What am I missing, anyone facing the same issue or fixed it?
Thanks.
The text was updated successfully, but these errors were encountered: