The discussion revolves around using an off-site avatar via API in Discourse. Judith is trying to unify user avatars between her community Rails site and Discourse, using the Discourse API to update avatars. However, her attempts result in an Internal Server Error.
osioke suggests using the sso overrides avatar site setting and passing the avatar URL with the SSO system, which Judith considers but notes that this poses an integration problem, as some users have avatars on one site but not the other.
blake points out that the issue with Judith’s API request might be due to not reading the file correctly and suggests using the discourse_api gem to update an avatar by specifying a URL.
I have a community Rails site. I’m using SSO so that community members don’t have to separately log into Discourse and I’m using the Discourse API in order to facilitate exchange of information between the two servers. Now I’d like to unify user avatars, i.e. use the same avatar on the forum as on my main site. How do I do that?
I tried what I usually do for API requests, namely a Faraday POST request to https://discuss.diem25.org/uploads.json with API key and API-Username in the header and the following body:
This request results in an Internal Server Error. I’m also not opposed to re-uploading the file as a last resort, but that seems to be difficult to impossible at first glance, using Faraday.
Why not try the sso overrides avatar site setting and pass the avatar URL with the SSO system? It may be better to handle this with SSO rather than making uploads manually with the API.
Thanks, that’s a good idea, it just poses the integration problem the other way round, because right now some users have an avatar on Discourse and don’t have an avatar on my site. So my choices are, it seems, to upload all Discourse avatars to my site and then set “sso overrides avatar”, or to upload all of my avatars to Discourse.