Please upgrade here. These earlier versions are no longer being updated and have security issues.

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.

Tagged:
«13

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.

Sign In or Register to comment.