# 由于:respond\_to\_suspicous\_request 导致用户创建不一致

**URL:** <https://meta.discourse.org/t/incongruous-user-creation-due-to-respond-to-suspicous-request/108625>\
**Category:** Development\
**Created:** [2019年二月7日 18:49 UTC](https://meta.discourse.org/t/incongruous-user-creation-due-to-respond-to-suspicous-request/108625 "2019-02-07T18:49:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![benjaminkreen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/benjaminkreen/32/131034_2.png) [@benjaminkreen](https://meta.discourse.org/u/benjaminkreen)\
**Post date:** [2019年二月7日 18:49 UTC](https://meta.discourse.org/t/incongruous-user-creation-due-to-respond-to-suspicous-request/108625/1 "2019-02-07T18:49:16Z")

</div>

Heyo.

I’m trying to integrate a salesforce trigger that creates a Discourse account over the api. I’ve generated a API key for the default system user who is admin, and when I create the user from the ruby repl it works fine but when its coming from salesforce it gets caught up in the titular before action.

Here’s the log I’m seeing:

```plaintext
Started POST "/users.json" for 184.23.159.2 at 2019-02-07 18:22:36 +0000
Processing by UsersController#create as JSON
  Parameters: {"api_key"=>"[FILTERED]", "api_username"=>"system", "username"=>"test4", "name"=>"BAZ QUX", "password"=>"[FILTERED]", "email"=>"test5@plos.org"}
Completed 200 OK in 226ms (Views: 0.2ms | ActiveRecord: 44.8ms)
Sent mail to test5@plos.org (369.1ms)
Can't reach '/plugins/discourse-narrative-bot/images/font-awesome-ellipsis.png' to get its dimension.
Can't reach '/plugins/discourse-narrative-bot/images/font-awesome-bookmark.png' to get its dimension.
Started POST "/users.json" for 13.108.254.8 at 2019-02-07 18:24:47 +0000
Processing by UsersController#create as JSON
  Parameters: {"username"=>"dev1-742", "email"=>"dev1@plos.org", "name"=>"PLOS Test", "password"=>"[FILTERED]", "api_key"=>"[FILTERED]", "api_username"=>"system", "user"=>{"username"=>"dev1-742", "name"=>"PLOS Test"}}
Filter chain halted as :respond_to_suspicious_request rendered or redirected
Completed 200 OK in 2ms (Views: 0.3ms)

```

The first call is the successful ruby call, the second its the failing salesforce call. The only weird difference I can see is Rails nesting some of the controller’s model’s params. Any thoughts?

---

<div class="post-metadata">

**Author:** ![benjaminkreen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/benjaminkreen/32/131034_2.png) [@benjaminkreen](https://meta.discourse.org/u/benjaminkreen)\
**Post date:** [2019年二月7日 19:48 UTC](https://meta.discourse.org/t/incongruous-user-creation-due-to-respond-to-suspicous-request/108625/2 "2019-02-07T19:48:42Z")

</div>

Okay, I solved it. The httparty gem was defaulting to url form encoded content type while salesforce was using json, it works now that i’ve updated the script.
