Search code examples
erlangchicagoboss

How to decipher ChicagoBoss Post param


I'm a newbie in ChicagoBoss web framework. I have a server which receives a POST request from another server where POST params is of the form:

<<"clientId=STRING_FOR_CLIENT_ID&userId=STRING_FOR_USER_ID&sessionToken=STRING_FOR_SESSION_TOKEN">>

All I have to do is to add clientSecret=CLIENT_SECRET_STRING to this POST params in my server and resend it to the server outside to retrieve access_token.

It would be great if someone suggest some basic code how this can be done.


Solution

  • Are you making the client secret string from the original post data? Anyway, if you can use ibrowse, then:

    %% send form data as iolist
    Data = <<"clientId=STRING_FOR_CLIENT_ID&userId=STRING_FOR_USER_ID&sessionToken=STRING_FOR_SESSION_TOKEN">>,
    ibrowse:send_req("http://httpbin.org/post",
                 [], post,
                 [Data, <<"&clientSecret=CLIENT_SECRET_STRING">>]).