How to update profile information via API

I would like to sync profile information like the bio, and website URL from my website to the discourse user forum. Users are currently all logging in via an SSO endpoint on the main website. Is there any way to update the discourse user profile via an API call?

I have tried doing something like this, unsuccessfully:

require 'single_sign_on'
class DiscourseSsoController < ApplicationController
  before_filter :authenticate_user! # ensures user must login

  def sso
    sso = SingleSignOn.parse(request.query_string, secret) = # from devise = # this is a custom method on the User class
    sso.username = # from devise
    sso.external_id = # from devise
    sso.sso_secret = secret
    sso.avatar_url = current_user.image_url =
    sso.custom_fields["profile_url"] = SOME_URL

    redirect_to sso.to_url(ENV["DISCUSSIONS_SSO_LOGIN_PATH"])
1 Like

No help? I wonder if my question is clear enough…

Using the API:

curl -X PUT -d 'name=BOB TEST' http://your.discourse.instance/users/<DISCOURSE_USERNAME>.json?api_key=<API_KEY>&api_username=<API_USER>

Take a look at the Discourse API.