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.

Installing jsConnet

My web site has its own "login" in wsite/index.php and

vanilla forum in wsite/vanilla/ the auth.json file in wsite/vanilla

I generete client ID & secret with vanilla Dashboard

Site Name:

Authenticate Url: /vanilla/auth.json

Sign In Url: /index.php

Register Url: /registrar.php

The code WriteJsConnect($user...... is in the wsite/index.php

I test URL and obtain "page not found error 404"

Can I get some help


  • hbfhbf wiki guy? MVP
  • Hola hbf I sent a email to you but I haven't permission to comment through email.

    Thanks for your quickly answer.
    I test different urls and impossible to avoid the 404 error.
    Well, let ask some questions to tray understand concepts and fix my Knowledge. I am new in php and have a lot of limitations specially with http functions.
    With the user ID, name, email, etc. validated in web login, Jsconnect send data to auth.php page with the function WriteJsConnect($user, $_GET,.... .
    Auth.php page is a blank page without code.
    I include the functions.jsconnect.php in the login.php and in registrar.php.
    I put the example you provide in login.php and registrar.php, we only need to adapt code to build correctly the array $user with client ID, secret, etc.
    Vanilla get data of auth.php page and login user in the forum.
    Finally putting the correct URL with vanilla dashboard. And should it works.
    It´s that correct?.
    Thanks for your help

  • hbfhbf wiki guy? MVP

    i've never actually setup jsconnect, so i'm only able to provide some clues as to where i would start debugging.

    the first thing to do is to determine what url it's trying to load when you get the 404. basically a 404 just says, you asked for something on this server, and i have no resource (file) at that path.

    once you know what its trying to load and cant find, then figure out why it cant find it.

    you'll have to play detective here, look for the clues. post info that you dont know how to interpret and someone should be able to decipher it for you.

    1. Please privide full urls to the authentication link.

    2. I would not put the authentication script in the same folder as your vanilla install

    3. Do you use a jsconnect library for php?

  • Helo HalfCat,

    I am using local host and two virtual host; one for and a different one for

    I change auth.json to

    With full paths now a blank page appears when testing. The log in site is Ok but not in Vanilla,

    The functions.jsconnect.php is in I get from "Implementing Vanilla jsConnect Single-Signon on your Site". Is include before preparing $user array.

    I only use $user['email'] and $user['name'] vars to pass vanilla login. Is sufficient?


  • @rvch said:
    The functions.jsconnect.php is in I get from "Implementing Vanilla jsConnect Single-Signon on your Site". Is include before preparing $user array.

    I don't understand. You have to include the functions.jsconnect.php into the script you use to produce the json data.

    I only use $user['email'] and $user['name'] vars to pass vanilla login. Is sufficient?

    No, it is not. You need to set $user['uniqueid'] too. This is how it looks like for me after some error checking:

    require_once 'functions.jsconnect.php';
    $clientID = "1234567890";
    $secret = "abcdefghijkl1234567890";
    $user = array();
    $user['uniqueid'] = $_SESSION['ID'];
    $user['name'] = $_SESSION['User'];
    $user['email'] = $_SESSION['eMail'];
    $user['photourl'] = '';
    $secure = true; 
    WriteJsConnect($user, $_GET, $clientID, $secret, $secure);

    I don't know how your own login process is created but you should be able to work this out...

  • Thanks HalfCat,

    Now I get the error

    {"error":"invalid_request","message":"The client_id parameter is missing."}

  • Ok, we are making progress. Can you post the part of the code you are passing in the WriteJsConnect function?

  • You mind this:

    require_once 'functions.jsconnect.php';

    $clientID = "68065092";

    $secret = "a5e0ce3589ec6fd8cbb39396b33ac4fd";

    $user = array();


    $user['email'] = $_SESSION['email'];

    $user['name'] = $_SESSION['alias'];

    $user['photourl'] = '';

    $secure = true;

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

  • Mhm, that seems to be correct. Do you have session_start(); at the beginning of your script?

  • Yes

  • HalfCatHalfCat ✭✭
    edited December 2012

    Can you print the Session array correctly?

  • Yes

  • And you get this error when you call the Test-URL in your dashboard, right? If that is the case, I am at the end of my knowledge. I don't know what else could be done here, sorry...

  • I get the error in de index.php when finishing the process of login on my web site and after call to WriteJsConnect.

    With test I get a blank page with this url

  • Something is severely wrong. You do not call WriteJsConnect in your login process. You only call that on a page that has only one purpose: be the authentication url for vanilla. This site is only called by the javascript of vanilla, it isn't there to be called by you in your login process. What does that auth.json file look like?

  • The auth.json file is blank. What we need to put there?.

  • HalfCatHalfCat ✭✭
    edited December 2012

    Err, all the code we discussed above. Just don't name it auth.json but rather auth.json.php as you want executable php in there. Alternatively just change the settings of your jsConnect in your dashboard to point to the file where you have the code already...

Sign In or Register to comment.