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.

Vanilla 2.3 fully supports PHP 7. Get it now!

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-&gt;prepare('SELECT * FROM users WHERE email = ? AND active= ?');
$stmt-&gt;bind_param('si', $email, $active);
$stmt-&gt;execute();
$result = $stmt-&gt;get_result();

if ($result-&gt;num_rows == 1) {
    $row = $result-&gt;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

  • There seems to be no good authentic documentation... this should be working..

  • whu606whu606 I'm not a SuperHero; I just like wearing tights... Moderator
    edited April 13

    @Rome

    Can we assume you found this documentation unsatisfactory?

    http://docs.vanillaforums.com/help/sso/jsconnect/overview/

    I'm not trying to be clever - if you read this and it didn't help, it would be worth letting the Vanilla team know.

  • yes you can because I can echo out the session info for my site.. I have have downloaded the php library have everything filled out per docs and it does nothing

  • @whu606 said:
    @Rome

    Can we assume you found this documentation unsatisfactory?

    http://docs.vanillaforums.com/help/sso/jsconnect/overview/

    I'm not trying to be clever - if you read this and it didn't help, it would be worth letting the Vanilla team know.

    According to the docs git about 5 posts everything should be working but its not. unless they have left info out.

Sign In or Register to comment.