Oauth2 json avatar path not working

AI-generated summary

In a bug report titled ‘Oauth2 json avatar path not working,’ kueda reported that while OAuth2 login successfully imported username, name, and email, the avatar failed to display — defaulting to a colored circle with the user’s initial. They confirmed the JSON response included valid avatar URLs (e.g., original_user_icon_url, medium_user_icon_url), but the avatar path setting wasn’t being applied on initial login. codinghorror escalated the issue to david, who identified the root cause: the avatar was only fetched on subsequent logins, not the first. He provided a fix via commit and noted that the trial site would be updated. After the update, kueda confirmed the issue was resolved and thanked the team for the quick fix.

I’m trying to get the oauth2 basic plugin working on a trial version of hosted Discourse. Everything seems to work, except for the oauth2 json avatar path, so I suspect I’m just doing something wrong. The response to the user JSON request looks something like this:

{
  "email": "an.email.address@gmail.com",
  "id": 123,
  "login": "anemailaddress",
  "name": "An Email Address",
  "medium_user_icon_url": "https://static.inaturalist.org/attachments/users/icons/61724/medium.jpg?1475527316",
  "original_user_icon_url": "https://static.inaturalist.org/attachments/users/icons/61724/original.jpg?1475527316",
  "user_icon_url": "https://static.inaturalist.org/attachments/users/icons/61724/thumb.jpg?1475527316"
}

I’ve set the oauth2 json avatar path to original_user_icon_url (I’ve tried medium_user_icon_url, too), but every time I create a new account via OAuth, the user’s avatar image is just the default colored circle with the first letter of their name. Username, name, and email import just fine. This feels buggy, but am I just missing a configuration here?

2 Likes

Any ideas here @david ?

Hi @kueda, I think I see the issue here. We didn’t fetch the avatar on the initial login - it only happened on subsequent logins. This should fix the problem:

https://github.com/discourse/discourse-oauth2-basic/commit/090f63c4290672a4e399f7c68b84a4f896ca6d36

Please update to the latest version of the plugin and see if that helps.

I see you’re on one of our trials. I’ll let you know once we’ve updated your site.

All up-to-date - let us know how you get on @kueda :slight_smile:

7 Likes

Awesome, working now. Thanks for the quick turnaround!

6 Likes

This topic was automatically closed after 23 hours. New replies are no longer allowed.