Discourse API SSO sync fails to find record

(Buford Taylor) #1

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'])
from /usr/local/lib/ruby/gems/2.4.0/gems/discourse_api-0.17.0/lib/discourse_api/client.rb:135:in `handle_error'

(Jeff Atwood) #2

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.

(Buford Taylor) #3

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?

(Jeff Atwood) #4

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

(Buford Taylor) #5

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: discourse/users_controller.rb at 2f0c6c99e07ae1aa2a7217bdad39e213557c49c2 · discourse/discourse · GitHub

Thanks again @codinghorror

(Régis Hanol) #6