How to use Discourse Connect (SSO) to update avatar, username, name?

I have been able to set up Discourse SSO at https://forum.mycoralapp.com

And I am able to create the user the first time, with their very own email, name, username and avatar.

But the question is, how can I update them once they change on our side (in the app)? I log out and log in with SSO, sending a different name, username and photo, but the old ones remain. I also checked off these things in the admin, which seems like it ought to override at least the avatar, but nothing happens:

Is the name and username always available to be changed? Why isn’t it mentioned alongside “avatar”? In practice, though, NOTHING changes

1 Like

Can you share the Discourse Connect code that your app is running? It sounds like it’s not sending the information over in the right way.

2 Likes

Something like this: Here is some PHP code and you'd do similar for iOS and Android. Remember to intercept the URL request in WebView! ¡ GitHub

It is good enough to create the account, with the correct info. But it doesn’t override it later on subsequent logins.

According to this I have to enter the Rails app and set things like SiteSetting.discourse_connect_overrides_avatar . I don’t know if this is because it’s old instructions, but the admin control panel doesn’t even contain stuff like “override name” and “override username”.

2 Likes

@EGreg did you find a solution for this yet?
I’m facing the same issue with a self-hosted discourse.
SSO login doesn’t seem to override the username for existing accounts that existed before implementing SSO, even though the ‘override username’ setting is enabled.

@pfaffman helped me and I think it worked. Have to double check. Jay?

1 Like

Sorry. I don’t know if the to of my head about how existing accounts get connected and whether they get renamed or I would have responded on the other topic.

1 Like

Looking at this topic’s OP, I see that the auth overrides username setting isn’t shown as being enabled in the screenshot. That setting needs to be enabled for DiscourseConnect to override the username. It would be great if the settings page could make it more obvious that these three settings are related to DiscourseConnect:

  • auth overrides email
  • auth overrides username
  • auth overrides name

Also, make sure the users are logging out of Discourse, then logging back in via DiscourseConnect. If they don’t log out of Discourse, the change won’t take effect. You can get around that issue by making an API call to the sync_sso route on the user’s behalf: Sync DiscourseConnect user data with the sync_sso route.

3 Likes

Thanks, everyone.
I tried again with a different username and it worked.
I figured it was related to discourse username rules. Since the new username was starting with an underscore, it was invalid as per discourse rules and that could be the reason it wasn’t reflected in the forum.

2 Likes