Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

jsConnect Signature Full Example

mnelson77mnelson77 New
edited May 2014 in Vanilla 2.0 - 2.8

Does anyone have a demo example of signing your request using the jsConnect plugin. I have been through the docs for several hours; searched for an example; and attempted to implement as put forth in the docs. I am using the PHP library, version 2.1 Vanilla, and the latest version of jsConnect. I have the plugin working in test mode, but continue to get the signature invalid error.

I am trying to use sha1 as the hash. The email address is passed as a session variable. I have this set of code before defining the user array.

$sessionuserraw = rawurlencode($sessionuser);
$signature_string = "email=".$sessionuserraw."&name=Anonymous&uniqueid=".$sessionid."";
$signature = sha1("$signature_string"."$secret");

then to define the user I have

$user = array();

    if ($signedIn) {

       // CHANGE THESE FOUR LINES.
       $user['uniqueid'] = $sessionid;
       $user['name'] = 'Anonymous';
       $user['email'] = $sessionuser;
       $user['clientID'] =  '11111111';

    }

$secure = true;

WriteJsConnect($user, $_GET, $clientID, $secret, $secure);

I just need to see an example of how these pieces fit together, because the descriptions are not super clear to me.

Thanks for the help.

Comments

  • Any assistance with this question? When I look through the PHP library provided for the plugin, it looks like it is being signed within that script, but I am getting a Signature invalid error. Yet when I run in test mode and check the Test URL I see a Signature being generated in the JSON response.

  • If you put $Secure = TRUE; it will default to md5.

    put $Secure = 'sha1';

    grep is your friend.

Sign In or Register to comment.