Is it possible to make sso.avatar_url work on the first login?


Here is my code:

sso.avatar_url =
A user logs into the discourse for the first time, their avatar does not change.

They log out.

Now on logging back in again, the avatar is changed. Is there anyway to get this to work from the first login instead of them having to log out and back in again before seeing the avatar changed?

(Simon Cossar) #2

That doesn’t sound right. The avatar should be set the first time the user logs into Discourse.

What version of Discourse are you using?


Version taken from the < head > is



I have made changes to:

enable sso
sso url
sso secret

did I miss anything necessary to get this to work on the first login?

(Simon Cossar) #5

What is the website that you are using as the SSO provider? Is it WordPress or something else?


No, it is a ruby on rails app hosted by heroku.

(Simon Cossar) #7

The Discourse code for setting the SSO avatar is here:

You could try setting force_avatar_update=true in the parameters you are sending to Discourse.


No, it is the same situation. I have to login once and see the standard letter avatar and then on logging out and logging back in again, the avatar is updated.


Does it work on the first login in your app Simon?

(Simon Cossar) #10

Yes it’s set correctly on the first login. I’m using WordPress with the wp-discourse plugin. There is an issue with the avatar image not updating if it’s ever changed. This is because WordPress generally sets the avatar image using Gravatar. This will be fixed on the next update of the plugin.

If it helps, the wp-discourse SSO code is here: