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
Please upgrade to 2.3 here. The 2.2 and earlier branches are no longer being updated.

parseerror with jsconnect and vanilla 2.1|master branches

This discussion is related to the Vanilla jsConnect addon.

Greetings. I managed to get everything working up to the point where I see the specific user sso login link above the vanilla login|register buttons and on the pop out dialog. When I click on it, I get only the unhappy parseerror. I have error logging and debug enabled. This particular message does not render any logging information. The only two items in the get request are the client_id and "Target=%2F" and the sso test link shows the right json formatted information.

I have tried 1.4.1 release as well as the 2.1 branch from the vanilla/addons repo.

I could use some guidance in resolving this. I am sooo close to making this work.

«1

Comments

  • peregrineperegrine MVP
    edited July 2014

    get only the unhappy parseerror.

    post a screen shot of error.

    what line of code does it occur in?

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

    UnderDog
  • I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

    UnderDog
  • I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

    UnderDog
  • NirgaliNirgali New
    edited July 2014

    I went through those documents. There is nothing worth taking a screenshot. It simply says in large font "Whoops!" and below that "parsererror." I'm not sure what to try next because it doesn't give me any debugging. The following snippets have been redacted for privacy. After letting these forums convert the Target=% 2 F, I realized it becomes Target=/ which is what it should be.

    The sso login link is "http://_DOMAIN_/entry/jsconnect?client_id=_BIGINT_&Target=% 2F" and it properly displays my cms username and the gravatar image.

    The json code when I click "Test URL" in the dashboard: http://_DOMAIN_/index.php/jsonp?client_id=_BIGINT_&timestamp=1406783225&signature=_HEX_&Target=%2Fsettings%2Fjsconnect&callback=test

    The code which generates the json from concrete5 session:
    <?php defined('C5_EXECUTE') or die("Access Denied."); ?> <?php require_once dirname(__FILE__).'/elements/functions.jsconnect.php'; $user = array(); global $u; if ($u->isLoggedIn()) { $u = new User(); $uid = $u->getUserID(); $ui = UserInfo::getByID($uid); $av = Loader::helper('concrete/avatar'); $user['uniqueid'] = $uid; $user['name'] = $u->getUserName(); $user['email'] = $ui->getUserEmail(); if ($ui->hasAvatar()) { $user['photourl'] = $av->outputUserAvatar($ui); } elseif (strpos($av->outputUserAvatar($ui), 'gravatar') !== FALSE) { $gravatar = str_replace("\\", "", $av->outputUserAvatar($ui)); $re = '/\\/(?:\\/[\\w\\.\\-]+)+.s=\\d+&d=\\d+&r=g/'; preg_match($re, $gravatar, $matches); $user['photourl'] = "http:" . $matches[0]; } else { $user['photourl'] = ''; } } $clientID = "_BIGINT_"; $secret = "_HEX_"; $secure = 'sha1'; WriteJsConnect($user, $_GET, $clientID, $secret, $secure); ?>

  • hgtonighthgtonight ∞ · New Moderator
    edited July 2014

    Welcome to the community!

    If you ever see a 'Whoops' or 'Something went wrong' screen in Vanilla, debug mode should spit out more information.

    Is the request returning a 200 code? Have you looked into the request/response headers at all? Do you have a live site I could look at?

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

    UnderDog
  • It does return 200. Live site sent via private message. I thought I enabled debug mode by adding the following but this particular issue isn't logging anything.

    $Configuration['Garden']['Errors']['LogEnabled'] = TRUE; $Configuration['Garden']['Errors']['LogFile'] = 'logs/debug.log';

  • So... I'm back at it again. Found some free time to dig into this some more. Something I don't believe I pasted before was the 400 error I get in the vanilla access log.

    GET /entry/jsconnect?client_id=<number>&Target=%2Fdiscussions HTTP/1.1" 200 1898 "http://<domain>/discussions" "Mozilla/5.0 ..." POST /entry/jsconnect/error HTTP/1.1" 400 2011 "http://<domain>/entry/jsconnect?client_id=<number>&Target=%2Fdiscussions" "Mozilla/5.0..."

  • peregrineperegrine MVP
    edited August 2014

    is odd...

    &lt;

    so is this,

    http:///discussions" "Mozilla/5.0 ..."

    looks like your domain is not being translated or picked up correctly.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Nope, I replaced the domain with a less than, greater than, and the word domain for privacy. same with client_id

  • GET /entry/jsconnect?client_id=__CLIENTID__&Target=%2Fdiscussions HTTP/1.1" 200 1898 "http://__DOMAIN__/discussions" "Mozilla/5.0 ..." POST /entry/jsconnect/error HTTP/1.1" 400 2011 "http://__DOMAIN__/entry/jsconnect?client_id=__CLIENTID__&amp;Target=/discussions" "Mozilla/5.0..."

  • What do you get when you add this to your config?

    $Configuration['Debug'] = TRUE;
    

    My themes: pure | minusbaseline - My plugins: CSSedit | HTMLedit | InfiniteScroll | BirthdayModule | [all] - PM me about customizations

  • I apparently forgot to put that back in after reinstalling. At any rate, the information was unhelpful to me a while back so I didn't think to post it, but since you asked...

    Cache Information Cache Revision: 1 Permissions Revision: 1 2 queries in 0.0029468536376953s PermissionModel->PermissionColumns()0.001721s select * from GDN_Permission 'Permission' limit 1; PermissionModel->CachePermissions(0)0.000146s select MAX(p.'PermissionID') as 'PermissionID', MAX(p.'Garden.Email.View') as 'Garden.Email.View', MAX(p.'Garden.Settings.Manage') as 'Garden.Settings.Manage', MAX(p.'Garden.Settings.View') as 'Garden.Settings.View', MAX(p.'Garden.Messages.Manage') as 'Garden.Messages.Manage', MAX(p.'Garden.SignIn.Allow') as 'Garden.SignIn.Allow', MAX(p.'Garden.Users.Add') as 'Garden.Users.Add', MAX(p.'Garden.Users.Edit') as 'Garden.Users.Edit', MAX(p.'Garden.Users.Delete') as 'Garden.Users.Delete', MAX(p.'Garden.Users.Approve') as 'Garden.Users.Approve', MAX(p.'Garden.Activity.Delete') as 'Garden.Activity.Delete', MAX(p.'Garden.Activity.View') as 'Garden.Activity.View', MAX(p.'Garden.Profiles.View') as 'Garden.Profiles.View', MAX(p.'Garden.Profiles.Edit') as 'Garden.Profiles.Edit', MAX(p.'Garden.Moderation.Manage') as 'Garden.Moderation.Manage', MAX(p.'Garden.Curation.Manage') as 'Garden.Curation.Manage', MAX(p.'Garden.PersonalInfo.View') as 'Garden.PersonalInfo.View', MAX(p.'Garden.AdvancedNotifications.Allow') as 'Garden.AdvancedNotifications.Allow', MAX(p.'Conversations.Moderation.Manage') as 'Conversations.Moderation.Manage', MAX(p.'Conversations.Conversations.Add') as 'Conversations.Conversations.Add', MAX(p.'Vanilla.Approval.Require') as 'Vanilla.Approval.Require', MAX(p.'Vanilla.Comments.Me') as 'Vanilla.Comments.Me', MAX(p.'Vanilla.Discussions.View') as 'Vanilla.Discussions.View', MAX(p.'Vanilla.Discussions.Add') as 'Vanilla.Discussions.Add', MAX(p.'Vanilla.Discussions.Edit') as 'Vanilla.Discussions.Edit', MAX(p.'Vanilla.Discussions.Announce') as 'Vanilla.Discussions.Announce', MAX(p.'Vanilla.Discussions.Sink') as 'Vanilla.Discussions.Sink', MAX(p.'Vanilla.Discussions.Close') as 'Vanilla.Discussions.Close', MAX(p.'Vanilla.Discussions.Delete') as 'Vanilla.Discussions.Delete', MAX(p.'Vanilla.Comments.Add') as 'Vanilla.Comments.Add', MAX(p.'Vanilla.Comments.Edit') as 'Vanilla.Comments.Edit', MAX(p.'Vanilla.Comments.Delete') as 'Vanilla.Comments.Delete', p.JunctionTable as 'JunctionTable', p.JunctionColumn as 'JunctionColumn', p.JunctionID as 'JunctionID' from GDN_Permission p join GDN_UserRole ur on p.RoleID = ur.RoleID where ur.UserID = '0' group by p.JunctionTable, p.JunctionColumn, p.JunctionID; Page completed in 0.4301s Controller Data Exception: 'parsererror' _NoMessages: true BodyClass: 'Dashboard Home error SplashMessage NoPanel Section-Entry'

  • peregrineperegrine MVP
    edited August 2014

    just guessing but should it be where ur.UserID = '0' seems like an odd userid.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • The queries return respectively:
    PermissionID RoleID JunctionTable JunctionColumn JunctionID Garden.Email.View Garden.Settings.Manage Garden.Settings.View Garden.Messages.Manage Garden.SignIn.Allow Garden.Users.Add Garden.Users.Edit Garden.Users.Delete Garden.Users.Approve Garden.Activity.Delete Garden.Activity.View Garden.Profiles.View Garden.Profiles.Edit Garden.Moderation.Manage Garden.Curation.Manage Garden.PersonalInfo.View Garden.AdvancedNotifications.Allow Conversations.Moderation.Manage Conversations.Conversations.Add Vanilla.Approval.Require Vanilla.Comments.Me Vanilla.Discussions.View Vanilla.Discussions.Add Vanilla.Discussions.Edit Vanilla.Discussions.Announce Vanilla.Discussions.Sink Vanilla.Discussions.Close Vanilla.Discussions.Delete Vanilla.Comments.Add Vanilla.Comments.Edit Vanilla.Comments.Delete 1 0 NULL NULL NULL 3 2 2 2 3 2 2 2 2 2 3 3 3 2 2 2 2 2 3 2 3 0 0 0 0 0 0 0 0 0 0

    PermissionID Garden.Email.View Garden.Settings.Manage Garden.Settings.View Garden.Messages.Manage Garden.SignIn.Allow Garden.Users.Add Garden.Users.Edit Garden.Users.Delete Garden.Users.Approve Garden.Activity.Delete Garden.Activity.View Garden.Profiles.View Garden.Profiles.Edit Garden.Moderation.Manage Garden.Curation.Manage Garden.PersonalInfo.View Garden.AdvancedNotifications.Allow Conversations.Moderation.Manage Conversations.Conversations.Add Vanilla.Approval.Require Vanilla.Comments.Me Vanilla.Discussions.View Vanilla.Discussions.Add Vanilla.Discussions.Edit Vanilla.Discussions.Announce Vanilla.Discussions.Sink Vanilla.Discussions.Close Vanilla.Discussions.Delete Vanilla.Comments.Add Vanilla.Comments.Edit Vanilla.Comments.Delete JunctionTable JunctionColumn JunctionID 2 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 NULL NULL NULL 9 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 Category PermissionCategoryID -1

  • Also, for a bit of background, all I did to setup this instance was install the plugin and create an sso profile in it. On the concrete5 end, I added a file that pulls the user info and returns the json. The json looked good because the sso user and avatar shows up on the vanilla login page.

  • This looks like a problem with the json response.

    Could you validate what the test link gives you with http://jsonlint.com/ ?

    My themes: pure | minusbaseline - My plugins: CSSedit | HTMLedit | InfiniteScroll | BirthdayModule | [all] - PM me about customizations

    peregrine
  • not sure about the userid=0 bit. I assumed that had something to do with the fact that the user profile had not yet been created. I figured the jsconnect addon would do that or have I complete misinterpreted what I've read?

  • NirgaliNirgali New
    edited August 2014

    @Bleistivt It wraps the json in a 'jQuery1111111111111_111111111111({JSON})' where 'JSON' is the action response that checks okay with the jsonlint tool

  • NirgaliNirgali New
    edited August 2014

    @peregrine the userrole table starts at userid 0 which maps to role 2 or "Guest"

  • I don't use jsconnect, just taking wild stabs at it. hope you get a resolution.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • that seems weird, what's in the callback parameter of the test url?

    My themes: pure | minusbaseline - My plugins: CSSedit | HTMLedit | InfiniteScroll | BirthdayModule | [all] - PM me about customizations

  • NirgaliNirgali New
    edited August 2014

    the result of the test url is test({}"email":"email(at)domain.com","name":"Nirgali","photourl":"","uniqueid":"2","client_id":"11111111","signature":"1a1a1a1a1a1a1a1a1a1a1a1a1a")

    If I log out of concrete5 the result of the test url is
    test({"name":"","photourl":""})

    again, while logged into concrete5, I pulled the request from the concrete5 access logs and called it manually. The result was this
    jQuery111111111111111_11111111111111({"name":"Nirgali","photourl":""})

  • NirgaliNirgali New
    edited August 2014

    The real callback was this http://domain.com/index.php/jsonp?client_id=1111111111&Target=%2F&callback=jQuery111111111111111_11111111111111&_=11111111

    The test callback was this http://domain.com/index.php/jsonp?client_id=11111111111&timestamp=1409456533&signature=1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a&Target=%2Fsettings%2Fjsconnect&callback=test

  • While the JSON is valid, this is not a valid JSONP callback as the function jQuery111111111111111_11111111111111 obviously doesn't exist.

    Somehow the client_id and signature appears in the callback name.
    The http query is built in a wrong way.

    Which version of the jsConnect plugin are you using?

    If you are using the one of the addons repo, try this:
    https://github.com/vanilla/addons/tree/master/plugins/jsconnect
    and vice versa

    My themes: pure | minusbaseline - My plugins: CSSedit | HTMLedit | InfiniteScroll | BirthdayModule | [all] - PM me about customizations

  • NirgaliNirgali New
    edited August 2014

    Same results with the repo version and 1.4.1 release. Client version from repo as well (@version 1.1b).

  • BleistivtBleistivt MVP
    edited August 2014

    What functions are you calling from concrete5?
    Maybe the parameters for WriteJSConnect() are somehow switched with the ones for SignJSConnect().
    edit: just saw you already posted it above.

    Inspect what's in your $_GET array for "callback" on the concrete5 side when you try to sign in.

    My themes: pure | minusbaseline - My plugins: CSSedit | HTMLedit | InfiniteScroll | BirthdayModule | [all] - PM me about customizations

  • Yeah I printed that in this reply I tried looking but didn't find where it is sending that function. Are we tumbling down a rabbit hole?

    I've been staring at this code for a while. I can't make sense of it. If it works for other people...

  • To update version information in the OP. I am running with the latest git repo code for jsconnect and the vanilla 2.1.1 release. I tried a fresh installation of vanilla from master but there was a crippling bug preventing me from setting up connection while also allowing a confirmation login (the unconfirmed role drop down wasn't populated)

  • BleistivtBleistivt MVP
    edited August 2014

    A var_dump() of the $_GET from concrete5 without the sensitive data might be helpful.

    But with your problem you are better off asking someone who knows about the inner workings of jsconnect, e.g. @todd

    Edit: It looks like a problem on the side of your CMS though.

    My themes: pure | minusbaseline - My plugins: CSSedit | HTMLedit | InfiniteScroll | BirthdayModule | [all] - PM me about customizations

  • Yeah, Todd is too busy with executive stuff to worry about an addon. As I'm not interested in paying for support, I'll just continue hacking away at the code until I find something. I don't believe the issue is with the CMS because it spews forth the correct json.

«1
Sign In or Register to comment.