Discourse API SSO sync fails to find record

I’m attempting to update the email records of a user via the API.

Here’s me finding the record by external_id:

[20] pry(main)> c.by_external_id("1388")
=> {
                                  "id" => 2,
                            "username" => "Buford_Taylor",

Here’s it failing to sync_sso with that same external_id

[21] pry(main)> c.sync_sso(external_id: "1388", sso_secret: ENV['DISCOURSE_SSO_SECRET'])
DiscourseApi::NotFoundError:
from /usr/local/lib/ruby/gems/2.4.0/gems/discourse_api-0.17.0/lib/discourse_api/client.rb:135:in `handle_error'

Mail was recently moved to a new one-to-many table setup so that might be impacting you here. The “email” field on the user table doesn’t work any more.

Gotcha, but shouldn’t sync_sso still be able to find that user by external_id, especially considering the command prior to it found the user by external_id?

Not sure, just offering a possibly related bit of info.

Right on.

Poking around the code, I figured it out. It was returning a 404 because I temporarily disabled SSO on my dev discourse server: https://github.com/discourse/discourse/blob/2f0c6c99e07ae1aa2a7217bdad39e213557c49c2/app/controllers/admin/users_controller.rb#L301

Thanks again @codinghorror

4 Likes