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

Ready to contribute?

Amazing! Sign our contributors' agreement and then join us on GitHub.

Update for critical security issue in PHPMailer included in release Vanilla 2.3.1

jsConnect php sso

RomeRome New
edited April 9 in Vanilla 2.3 Help

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
http://localhost/site/login.php

Signup Url
http://localhost/site/register.php

Log Out Url
http://localhost/site/logout.php

**Forums Located In **
http://localhost/site/forums/

Authentication URL
http://localhost/site/includes/auth.php

My login page function

`
<?php
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);
$stmt->execute();
$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"){
        rememberMe($id);
         }

        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.

Comments

Sign In or Register to comment.