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.
Options

Parse error trying to make JSConnect

edited April 2016 in Vanilla 2.0 - 2.8

Hi everyone
I'm trying to have a successful connection using JSConnect plug in, I've installed Vanilla jsConnect Client Library for PHP (https://github.com/vanilla/jsConnectPHP), I created one simple php page with a link redirecting to www.myforum.com/jsConnectPHP_sso/index.php but when my code tries to implement the JsConnect plug in, it throws me this error: "¡Ups!
parsererror"
and what I want is to log in with the basic information of a custom user located on index.php

This is my code,

<?php
require_once dirname(__FILE__).'/functions.jsconnect.php';

// 1. Get your client ID and secret here. These must match those in your jsConnect settings.
$clientID = "xxxxx";
$secret = "xxxxx";

// 2. Grab the current user from your session management system or database here.
$signedIn = true; // this is just a placeholder

// YOUR CODE HERE.

// 3. Fill in the user information in a way that Vanilla can understand.
$user = array();

if ($signedIn) {
   // CHANGE THESE FOUR LINES.
   $user['uniqueid'] = '00000000';
   $user['name'] = 'John';
   $user['email'] = 'john@gmail.com';
   $user['photourl'] = '';
}

// 4. Generate the jsConnect string.

// This should be true unless you are testing. 
// You can also use a hash name like md5, sha1 etc which must be the name as the connection settings in Vanilla.
$secure = true; 
WriteJsConnect($user, $_GET, $clientID, $secret, $secure);

?>

I've been searching and I found that the key is on the code above but I don't figure what It might be :confounded:

Any sugestion?

Comments

  • Options
    hgtonighthgtonight ∞ · New Moderator

    I have 2 suggestions.

    1. Remove the closing ?> tag. This will get rid of any whitespace errors.
    2. Change $secure to false for testing.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • Options

    @hgtonight said:
    I have 2 suggestions.

    1. Remove the closing ?> tag. This will get rid of any whitespace errors.
    2. Change $secure to false for testing.

    Still the problem, @hgtonight

Sign In or Register to comment.