Skip to content
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

fix(microsoft) get_avatar_url does not work #3630

Closed
wants to merge 1 commit into from
Closed

fix(microsoft) get_avatar_url does not work #3630

wants to merge 1 commit into from

Conversation

arowley-ai
Copy link

@arowley-ai arowley-ai commented Feb 7, 2024

Issue

This pull request fixes an with get_avatar_url for the Microsoft provider which as far as I can tell, does not work at all.

Solution

To fix the issue two additional requests were necessary. Firstly, to get a little metadata about the return type for the user photo and then to pull the user photo itself. I proposed a new setting that will enable/disable this behaviour as clearly we have the opportunity to save time for the majority of requests that do not need a user photo.

I chose to entirely replace the get_avatar_url method in the provider. That could be a little controversial since maybe somewhere out there somebody has an app that actually returns a valid URL but I am reasonably confident that this is not possible. As far as I can tell, the only endpoint from which any user photo can be accessed is via "https://graph.microsoft.com/v1.0/me/photo" and the only way to access the photo is as a binary stream (rather than a url).

The get_avatar_url method will provide a base64 encoded image stream directly instead of a url. I would have preferred the url option but apparently not with Microsoft. Nonetheless this solution will still render the image in place exactly as a valid url would. I think therefore that it is consistent with the original intent of this function but please let me know if you disagree.

To do

I am happy to update the documentation on this if it looks like something that can be accepted.

@coveralls
Copy link

Coverage Status

coverage: 95.759% (-0.05%) from 95.805%
when pulling 80546d2 on arowley-ai:main
into ad89388 on pennersr:main.

@arowley-ai
Copy link
Author

just fixed a little formatting

@arowley-ai arowley-ai closed this Feb 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants