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 php sso

RomeRome New
edited April 2017 in Vanilla 2.0 - 2.3

I have been over this several times and I have looked at almost every documentation I could find but I am stuck.

I have downloaded the latest version of vanilla and I have downloaded the latest version of the jsconnect plugin..

I have all the conficuration set in the jsconnect plugin settings in the admin area

jsConnect settings

Login Url

Signup Url

Log Out Url

**Forums Located In **

Authentication URL

My login page function

function login_user($email, $password){

$active = 1;

$db = dbconnect();
$stmt = $db->prepare('SELECT * FROM users WHERE email = ? AND active= ?');
$stmt->bind_param('si', $email, $active);
$result = $stmt->get_result();

if ($result->num_rows == 1) {
    $row = $result->fetch_array();

    $id = $row['id'];
    $email = $row['email'];
    $username = $row['username'];
    $db_password = $row['password'];

    isset($_POST['remember']) ? $remember = $_POST['remember'] : $remember = "";

    if (password_verify($password, $db_password)) { 

        $_SESSION['id'] = $id;
        $_SESSION['email'] = $email;
        $_SESSION['username'] = $username;

        $fingerprint = md5($_SERVER['REMOTE_ADDR'] . $_SERVER['HTTP_USER_AGENT']);
        $_SESSION['last_active'] = time();
        $_SESSION['fingerprint'] = $fingerprint;

       if($remember === "yes"){

        return true;
    } else {
        return false;
    return true;
} else {
    return false;


My authenticate.php

<?php require_once '../db/db_config.php'; // 1. Get your client ID and secret here. These must match those in your jsConnect settings. $clientID = "xxxxxxxx"; $secret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxx"; // 2. Grab the current user from your session management system or database here. if(isset($_SESSION['user'])) $signedIn = true; // 3. Fill in the user information in a way that Vanilla can understand. $user = array(); if ($signedIn) { // CHANGE THESE FOUR LINES. $user['uniqueid'] = $_SESSION['user']['id']; $user['name'] = $_SESSION['user']['username']; $user['email'] = $_SESSION['user']['email']; $user['photourl'] = SITE_URL.'img/users/'.$_SESSION['user']['profile_image']; } $secure = 'sha1'; WriteJsConnect($user, $_GET, $clientID, $secret, $secure); exit(); ?>

so I login to my site everything is great I click forums it says I'm not logged in.


Sign In or Register to comment.