SSO - custom picture not getting updated again once it is updated initially

We are integrating discourse with Php/Laravel platform where we have implemented SSO. Users custom picture getting updated only once. However if i change profile picture in laravel platform, custom picture not updated in discourse again even after i logout and login again.

Even though i have passed ‘avatar_force_update’ as true, avatar custom picture is not getting overriden.

Just to update

I can see profile picture url updated SSO record, however new profile image is not reflected in discourse even after i logout and login again.

What if you reload your browser?

Do you have the discourse_connect_overrides_avatar site setting enabled?

1 Like

Thank you for reply. If I reload browser or open in incognito or even logout and login again, it doesnt get updated.
As mentioned, it gets updated only first time. For example

  • New user has avatar and connects discourse first time using sso, avatar gets updated
  • Or user doesnt have avatar initially, and updates avatar in platform and in that case it gets reflected in discourse
  • But user has one avatar and if he updates new avatar in platform, it doesnt get updated in discourse even though if i logout/login again, or try in different browser.I can see profile picture url updated SSO record, but the avatar doesnt get updated.

Thank you for you reply Renato! I dont have any other checkboxes ticked

You can try turning on verbose logging and looking at the logs to see if the SSO system is sending over the avatar info.

1 Like

It might be worth enabling the discourse connect overrides avatar setting, logging out of Discourse, then logging back in again. I’m fairly sure it’s expected that the avatar can be updated without that setting enabled as long as the avatar_force_update parameter is set to true in the SSO payload. The code that handles this is kind of complex though: discourse/app/models/discourse_connect.rb at 2ff3f44b957268718e03554fb25d485e1d449ed5 · discourse/discourse · GitHub.

If you can’t enable that setting, or are just curious about what’s going on, another thing to check is to make sure that the value you’re passing for the avatar_force_update parameter is being interpreted as the boolean true by Discourse. There are frameworks (notably WordPress) where boolean values get converted to 0 or 1. To work around that issue, Discourse will accept the string "true" as a boolean value in the SSO payload. You can probably confirm this by looking at the value of the avatar_force_update field in the SSO record that’s displayed on the user’s admin page. Or by enabling the verbose logging setting that Jay mentioned.

2 Likes