Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Try Vanilla Forums Cloud product

In this Discussion

Vanilla 2.6 is here! It includes security fixes and requires PHP 7.0. We have therefore ALSO released Vanilla 2.5.2 with security patches if you are still on PHP 5.6 to give you additional time to upgrade.
Please upgrade to 2.3 here. The 2.2 and earlier branches are no longer being updated.

jsConnect Signature Full Example

This discussion is related to the Vanilla jsConnect addon.
mnelson77mnelson77 New
edited May 2014 in Vanilla 2.0 - 2.3

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.

    peregrinehgtonightptoone
Sign In or Register to comment.