jsConnect php sso
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
There seems to be no good authentic documentation... this should be working..
@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
According to the docs git about 5 posts everything should be working but its not. unless they have left info out.