Any help to configure jsConnect with CMSMS ?
Hi,
I'm using CmsMadeSimple as CMS for a site, but, as it doesn't provide a flexible board module, I wanted to use Vanilla, with the jsConnect plugin to sign in my Cmsms's FrontEnd Users in Vanilla.
I've read the all the plugin's documentation, and I use the php library to connect the plugin.
Vanilla is embed in a page called "board.html".
Here's the snippet (from "index.php" in php library) used in my page (board.html), before I call the plugin in the page.
$Id = $smarty->get_Template_Vars('userid'); $UserName = $smarty->get_Template_Vars('username'); $Email = $smarty->get_Template_Vars('email'); require_once dirname(__FILE__).'/functions.jsconnect.php'; // 1. Get your client ID and secret here. These must match those in your jsConnect settings. $clientID = "xxxxxx"; $secret = "xxxxxxxxxxxxxxx"; // 2. Grab the current user from your session management system or database here $signedIn = true; // this is just a placeholder // YOUR CODE HERE. // 3. Fill in the user information in a way that Vanilla can understand. $user = array(); if ($signedIn) { $user['uniqueid'] = $Id; $user['name'] = $UserName; $user['email'] = $Email; $user['photourl'] = $Photo; } // 4. Generate the jsConnect string. // This should be true unless you are testing. // You can also use a hash name like md5, sha1 etc which must be the name as the connection settings in Vanilla. $secure = true; WriteJsConnect($user, $_GET, $clientID, $secret, $secure); //EOF
After I've configured the plugin, I add a connection, then click the "Test URL" link and got the following output :
test({"email":"xxxxx@yahoo.xxx","name":xxxx xxxx","photourl":"","uniqueid":"xxxxx","client_id":"xxxxxxx","signature":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"})
My infos are well given above : clien_id, signature, email, name and uniqueid are matching.
Now, I try to access to my page (board.html) directly form my browser and here's my output :
{"error":"invalid_request","message":"The client_id parameter is missing."}
The user isn't created and not loggedin. Just the message "Howdy, stranger".
I don't uderstand why the client_id parameter is missing where with the test URL link it shows the good client_id.
If I add (just to verify) in functions.jsconnect.php at line 73 the following line :echo $client_id;
I have the good client_id shown.
Maybe the solution to my problem is here vanillaforums.org/discussion/18350/solved-vanilla-admin-account-updated-by-jsconnect-login but I could'nt find any clue.
Any idea to help me and solve this situation ?
Thanks,
Squarou
Answers
Ok, I've also created another Connection in jsConnect, without better result...
I'm still searching.
PS : I did'nt know how to paste my php code in my post...
Ok now : I'm trying to connect to the forum's page with : www.mysite.com/board.html#/entry/jsconnect?client_id=xxxxxx
Still have the {"error":"invalid_request","message":"The client_id parameter is missing."} message, AND it Freezes to "Connecting...".
DEBUG INFORMATION :
select *
from GDN_UserAuthenticationProvider UserAuthenticationProvider
where AuthenticationKey = 'xxxxxx';
And
client_id: 'xxxxxx'
Title: 'Connecting...'
BodyClass: 'Dashboard Entry jsconnect '
FYI : there's no javascript running in my board.html page in order to not create any interferences.
Still digging...
OK. I cleaned all and reinstall everything. You can forget what is written above. I separate the authentication (board.html) page and the forum page (tutos.html).
My CMS is under mysite/cms
Vanilla is in mysite/cms/board
Embed forum page under : http://www.mysite/cms/tutos.html
Authentication page : http://www.mysite/cms/board.html
This is PHP code embed in board.html :
<?php global $gCms; // Global CMSMS require_once dirname(__FILE__).'/functions.jsconnect.php'; $feu =& cms_utils::get_module('FrontEndUsers'); // $userloggedin = $feu->LoggedIn(); // $Id = $smarty->get_Template_Vars('userid'); $UserName = $smarty->get_Template_Vars('username'); $Email = $smarty->get_Template_Vars('email'); $Photo = ''; // 1. Get your client ID and secret here. These must match those in your jsConnect settings. $clientID = '877175447'; $secret = '1520c7656ab0a94156784adcd7405d2b'; // 2. Grab the current user from your session management system or database here if($userloggedin){ $signedIn = true; // this is just a placeholder } // YOUR CODE HERE. <-- do I need something more here ? // 3. Fill in the user information in a way that Vanilla can understand. $user = array(); if ($signedIn) { $user['uniqueid'] = $Id; $user['name'] = $UserName; $user['email'] = $Email; $user['photourl'] = $Photo; } // 4. Generate the jsConnect string. // This should be true unless you are testing. // You can also use a hash name like md5, sha1 etc which must be the name as the connection settings in Vanilla. $secure = true; WriteJsConnect($user, $_GET, $clientID, $secret, $secure); ?>
Now, if I want to test URL being logged in :
The result is :
At this point, the test URL is successfull isn't it ? The user's values are well transmitted.
Going back directly to
http://www.sfp-apa.fr/cms/board.html?client_id=877175447&callback=foo
(still loggedin), the result is :Isn't this callback a little shorty ?
Now, when I visit the forum's page with this address : http://www.mysite/cms/tutos.html#/entry/jsconnect?client_id=877175447
I've got a "Connecting..." message but nothing more happens.
This is the source of the frame for more details.
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-ca"> <head> <title>Connecting... - Forum</title> <link rel="stylesheet" type="text/css" href="/cms/board/applications/dashboard/design/style.css?v=2.0.18.4" media="all" /> <link rel="stylesheet" type="text/css" href="/cms/board/themes/EmbedFriendly/design/custom.css?v=1.0" media="all" /> <link rel="shortcut icon" href="/cms/board/themes/EmbedFriendly/design/favicon.png" type="image/x-icon" /> <link rel="canonical" href="http://www.mysite.com/cms/board/dashboard/entry/jsconnect" /> <script src="/cms/board/js/library/jquery.js?v=2.0.18.4" type="text/javascript"></script> <script src="/cms/board/js/library/jquery.livequery.js?v=2.0.18.4" type="text/javascript"></script> <script src="/cms/board/js/library/jquery.form.js?v=2.0.18.4" type="text/javascript"></script> <script src="/cms/board/js/library/jquery.popup.js?v=2.0.18.4" type="text/javascript"></script> <script src="/cms/board/js/library/jquery.gardenhandleajaxform.js?v=2.0.18.4" type="text/javascript"></script> <script src="/cms/board/js/global.js?v=2.0.18.4" type="text/javascript"></script> <script src="/cms/board/plugins/jsconnect/js/jsconnect.js?v=1.0.3b" type="text/javascript"></script> <script src="/cms/board/plugins/embedvanilla/local.js?v=1.0.6" type="text/javascript"></script> </head> <body id="dashboard_entry_jsconnect" class="Dashboard Entry jsconnect "> <div id="Content"><div style="margin-top: 25%"> <h1 style="text-align: center;">Connecting...</h1> <form id="Form_Form" method="post" action="/cms/board/entry/connect/jsconnect?client_id=877175447"> <div> <input type="hidden" id="Form_TransientKey" name="Form/TransientKey" value="G3U4N52WDAWX" /><input type="hidden" id="Form_hpt" name="Form/hpt" value="" style="display: none;" /><input type="hidden" id="Form_JsConnect" name="Form/JsConnect" value="" /><input type="hidden" id="Form_Target" name="Form/Target" value="/" /><div class="Progress"></div></div> </form></div></div> <!-- Various definitions for Javascript //--> <div id="Definitions" style="display: none;"> <input type="hidden" id="JsAuthenticateUrl" value="http://www.mysite.com/cms/board.html?client_id=877175447&timestamp=1336658107&signature=56341b6ec7a2f9e12474e2787b803330&Target=%2Fentry%2Fjsconnect&callback=?" /> <input type="hidden" id="RemoteUrl" value="http://www.mysite.com/cms/tutos.html" /> <input type="hidden" id="Path" value="entry/jsconnect" /> <input type="hidden" id="InDashboard" value="" /> <input type="hidden" id="TransportError" value="A fatal error occurred while processing the request.<br />The server returned the following response: %s" /> <input type="hidden" id="TransientKey" value="G3U4N52WDAWX" /> <input type="hidden" id="WebRoot" value="http://www.mysite.com/cms/board" /> <input type="hidden" id="UrlFormat" value="/cms/board/{Path}" /> <input type="hidden" id="SignedIn" value="2" /> <input type="hidden" id="ConfirmHeading" value="Confirm" /> <input type="hidden" id="ConfirmText" value="Are you sure you want to do that?" /> <input type="hidden" id="Okay" value="Okay" /> <input type="hidden" id="Cancel" value="Cancel" /> <input type="hidden" id="Search" value="Search" /> </div> </body> </html>
Why does I'm stuck at the "connecting" message ?
Help appreciated.
Thanks.
Hi, did you finally get anywhere with this? maybe you could also check the OpenID module?
Cheers
Dave