# Discourse\_api sync\_sso custom\_fields results in "custom.custom.\<field\>" in payload

**URL:** <https://meta.discourse.org/t/discourse-api-sync-sso-custom-fields-results-in-custom-custom-field-in-payload/140127>\
**Category:** Bug\
**Created:** [January 30, 2020, 12:18am UTC](https://meta.discourse.org/t/discourse-api-sync-sso-custom-fields-results-in-custom-custom-field-in-payload/140127 "2020-01-30T00:18:08Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![vkozyrev](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vkozyrev/32/167391_2.png) [@vkozyrev](https://meta.discourse.org/u/vkozyrev)\
**Post date:** [January 30, 2020, 12:24am UTC](https://meta.discourse.org/t/discourse-api-sync-sso-custom-fields-results-in-custom-custom-field-in-payload/140127/2 "2020-01-30T00:24:02Z")

</div>

This would have been a lot simpler imo, but don’t wanna break existing apps 😬. Leave SSO instance generation up to the user.

```plaintext
# frozen_string_literal: true
module DiscourseApi
  module API
    module SSO
      def sync_sso(sso)
        post("/admin/users/sync_sso", sso.payload)
      end
    end
  end
end

```

Maybe tomorrow I’ll do something like (but neater)

```plaintext
# frozen_string_literal: true
module DiscourseApi
  module API
    module SSO
      def sync_sso(params)
        if params.instance_of?(DiscourseApi::SingleSignOn)
          post("/admin/users/sync_sso", sso.payload) 
        elsif params.instance_of?(Hash)
          .... same as current
        end
      end
    end
  end
end

```

Thoughts? My app will ideally have a single function that generates `DiscourseApi::SingleSignOn`, and I’d then be able to pass it to `sso_login` or `sync_sso`

Or params can be defined like

```plaintext
{
  sso_secret: ...
  name: ...
  custom_fields: {
    field_1: ...
  }
}

```

Which would also break existing apps.

---

_[View the full topic](https://meta.discourse.org/t/discourse-api-sync-sso-custom-fields-results-in-custom-custom-field-in-payload/140127)._
