SSO Logout via Master API Key isn't working


(George Kushnir) #1
    discourseId = json.loads(urlopen('http://example.com/users/by-external/' + str(g.user_id) + '.json').read().decode('utf-8'))['user']['id']
    # This doesn't work and I have no idea why
    urlopen("http://example.com/admin/users/" + str(discourseId) + "/log_out?api_key=2345139133012345678909de3a3a4fc3ed01abcdef347b983667b0b1f00efb25&api_username=system")

Not my actual API key.

I’ve verified that the user_id passed to discourseId is correct, and I’m able to run the log_out endpoint with no error, it just doesn’t work! I’ve also tried using the actual user in place of system, to no avail.

Am I missing something?


(Simon Cossar) #2

It works if it’s a POST request. Try passing the api_key and api_username as data.


(George Kushnir) #3

That worked. Thanks a bunch.


(Sam Saffron) #4