Replies: 3 comments 1 reply
-
Hey thank you for this! I saw your post on Slack and used this as a starting point and made a few tweaks since I have Entra as a generic OIDC provider (not the social provider option) in an enterprise environment. I'm not a developer but was able to hack this together with some help. Also changed verbiage around "Profile Picture" versus "Avatar" since in our case that's the usage and keeps it more inline with wording in Entra space (Profile Photo / Profile Picture). I think it's helpful even outside of the account console, because now that can also be passed as claims to apps - some have asked for it this way before so will help a lot. Here's the few tweaks I made if it helps you at all. I included a drop down on the size because the baseline /photo/me is the "largest available size" and wanted some control around that. The account console was also having issues with really large sizes so I excluded anything above the 360x360 - at least the ones that I tested above that size would give a "something went wrong" error when getting into the account console (images were >80 KB in total size).
|
Beta Was this translation helpful? Give feedback.
-
Hey! I quickly checked your code and I like it much more than my hacky version :) Although I am not sure if the provider should be available for any generic OIDC provider, since it will really work only with AAD (or however they name it nowadays :D ) Thanks a lot! It would be awesome if we could get this merged into the keycloak's microsoft provider! If not, I will setup a repository with your improvements so others can contribute too. |
Beta Was this translation helpful? Give feedback.
-
Something else I was just looking at yesterday / today was if user changes their image. I don't want to do a Force update on very log in due to JIT. There is the ETag header returned which can be used in subsequent Graph requests with the If-None-Match header. This way there wouldn't be unnecessary fetching of the image content or writing to the database for no reason. I just haven't had much luck making it work exactly as desired, but the idea is something like: Get Etag from Graph and store in pictureEtag SPI checks if pictureEtag is present, if yes then include in request to Graph If-None-Match + Etag If user has not modified their image, 304 returned, skip picture update (no change) If user has modified their image, 200 ok returned + new picture + new ETag, update picture and pictureEtag attribute. |
Beta Was this translation helpful? Give feedback.
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,
I have implemented a following mapper SPI that fetches user avatar image from Graph API and saves it into a configurable user attribute.
To configure it, you need to:
Realm settings -> User profile -> Create attribute
(name itpicture
for seamless integration)After login, you should now see the "picture" attribute filled with the base64-encoded image data:

In account-console, you should see your avatar image.
Unfortunatelly, there is no way to get the avatar from Azure as a link, they only provide it as binary data (ref: https://learn.microsoft.com/en-us/graph/api/profilephoto-get?view=graph-rest-1.0&tabs=http )
I can create a github repository with a build for testing if requested, but first I would like to ask:
Beta Was this translation helpful? Give feedback.
All reactions