SSO & external avatars

When using SSO with sso overrides avatar: true, Discourse seems to download the avatar and always serve it locally instead of linking directly to the URL provided.

Would it make more sense to allow avatars to serve directly from the avatar_url provided? As is, for each avatar shown it hits Discourse backend somewhat needlessly. Perhaps this could be a SSO option?

If the concern is that avatars may go missing, that could be handled with the image onerror event that fallback’s src to the locally downloaded copy (or show a default one). What I don’t know is if too large avatars images can be constrained with CSS alone.

I believe disabling download_remote_images_to_local should solve your issue, although this will also serve images within posts remotely instead of locally.

That seems to be only for images in posts — or perhaps for local avatar too, when they are not overwritten by SSO.

1 Like

Interesting. I know that the OIDC Plugin allows you to override email on every login, maybe something like this would be possible for avatar’s being overwritten by SSO as well.

If the SSO avatar is in the format of https://central.avatar.service/<username> you can use the external_system_avatars_url site setting to get this feature.

It’s not in our case (they are served from S3) — and it’s unlikely to usually be in that format so that it can be efficiently cached.