Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

[Single Sign On] {"error":"invalid_request","message":"The client_id parameter is missing."}

edited June 2016 in Vanilla 2.0 - 2.8

My code used to work months ago, but today when I tried to modify something it crash out without any reason

<?php 
require('functions.jsconnect.php');
//require_once('lib/nusoap.php');
//$cliente = new nusoap_client("https://oet.itesm.mx/portalOETWS/PortalOETWebService?WSDL");
//require_once('/www/htdocs/lib/nusoap.php');
//require_once('webservice.php');

// 1. Get your client ID and secret here. These must match those in your jsConnect settings.
$clientID = "xxx";
$secret = "xxx";

// 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) {
// CHANGE THESE FOUR LINES. 
    $user['uniqueid'] = '123'; 
    $user['name'] = 'John PHP'; 
    $user['email'] = 'john.php@anonymous.com'; 
    $user['photourl'] = ''; 

}
// This is in the PHP file and sends a Javascript alert to the client
//$message = "wrong answer";
//echo "<script type='text/javascript'>alert('$message');</script>";

// 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 = 'sha1';
    WriteJsConnect($user, $_GET, $clientID, $secret, $secure);  // for full page forum
    JsSSOString($user, $clientID, $secret);  // add this line if using an embedded forum (remove if not embedded)
//$clientID['callback'] = $_GET['callback']; // Replace $_GET with any object you use in your framework

This is the configuration of my JS Connect , as reference... the ClientID and Secret Key are the same in my code and the configuration, and the URL that result when I try to log in is this ----> http://prod010ws05.itesm.mx/index.php?p=/entry/connect/jsconnect&client_id=MyClientID

Tagged:

Comments

  • @danytothetowers said:
    My code used to work months ago, but today when I tried to modify something it crash out without any reason

    What did you modify?

    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.

  • edited June 2016

    @hgtonight

    The admin where I work changed PHP 5.3 to PHP 5.5 because besides my single sign on code, I have a webservice code that was inoperative with that version of PHP, and doing what I tell you made the webservice operative again but for some reason the other code break out.

    I told you in the other discussion that changing $secure = false; to $secure = 'sha1'; and adding JsSSOString($user, $clientID, $secret); to my index.php worked for me, and I swear you that I didn't modify anything, this code break out changing PHP 5.3 to 5.5, but the point here is that it's not useful for me changing back to 5.3 because my operation depends on the webservice that works with 5.5

    Just for reference, also my jsconnect configuration it's the same as I had

    Sorry for my english If I repeat many words

    EDIT:

    I don't know if this is the reason but.... when I'm on my jsconnect configuration, I can't check this checkbox

  • edited June 2016

    @hgtonight

    More references...

    On my jsconnect settings I have this...

    Authenticate Url
    http://myforum.com/sso/index_sso.php

    Sign In URL
    http://myforum.com/?p=/entry/signin

    Register URL
    http://myforum.com/?p=/entry/register

    Sign Out URL
    http://myforum.com/index.php?p=/entry/signout&TransientKey=hereisthetransientkey

    and as I told you, I can't check "make this connection your default sign in method" checkbox knowing that the default register method is connect

    It could be that change to PHP 5.5 the reason that this code can't work? I think that it is not the reason, but why this code is not working if weeks ago used to work correctly??? :anguished:

    EDIT:

    Also..... When I click TEST URL I have good response... but when I access http://myforum.com/sso/index_sso.php I get this error {"error":"invalid_request","message":"The client_id parameter is missing."}

  • @hgtonight

    Last reference.... I tried to do exactly the same that I did here https://vanillaforums.org/discussion/32037/how-to-fix-parser-error but really really really it gives me the same error {"error":"invalid_request","message":"The client_id parameter is missing."}

    Also I have been changing and changing my ClientID and Secret and still the same mistake

    Any suggestion???

  • Someone else can help me please?

  • edited June 2016

    @hgtonight

    Hi again,
    Setting false to $secure variable

    $secure = false;
    WriteJsConnect($user, $_GET, $clientID, $secret, $secure);

    And adding this to the first lines of my code...

    <?php
    header('Content-Type: application/javascript');

    gives me this at /sso/index.php

    But it gives me this trying to see single sign on working on myforum.com


    I try to add what I said here ----> https://vanillaforums.org/discussion/32037/how-to-fix-parser-error#latest

    I just modified $secure = false; to $secure = 'sha1'; and it worked!!! haha and also added JsSSOString($user, $clientID, $secret); to my index.php

    And I get same error --> {"error":"invalid_request","message":"The client_id parameter is missing."}

    Could it be that sha1 it's not supported on PHP 5.5 ?

  • @danytothetowers said:

    Could it be that sha1 it's not supported on PHP 5.5 ?

    According to the docs, sha1() has been available since 4.3.0 and is in 5 and 7.

    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.

  • @hgtonight

    Ok, but then what do you think it might be the problem? The client_ID it's the same of jsconnect Configuration and single sign on code
    And for some reason this problem appeared when I changed 5.3 to 5.5

    I've tried:

    • Change jsconnect plug in to another versión
    • change everything of /sso and place it in another folder
    • Tried to use other hash functions

    Thanks for your help

  • Have you tried running your same code on PHP 5.3?

    Have you changed the domain?

    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.

  • @hgtonight

    I think that I'm going to talk about it with my boss, because it has no sense that two codes Work correctly with two different types of PHP Versions
    And more strange that my sso code was working fine and then when I uploaded 5.3 to 5.5 stopped working.

  • You need to update to 2.2.1 of vanilla and after the update of php, you need to delete the .ini files from the cache to get your site back.

    What do you normally use to single sign in with ? Facebook or WP or what ?

  • RiverRiver MVP
    edited July 2016

    @danytothetowers said:
    @hgtonight

    I think that I'm going to talk about it with my boss, because it has no sense that two codes Work correctly with two different types of PHP Versions
    And more strange that my sso code was working fine and then when I uploaded 5.3 to 5.5 stopped working.

    You may need to revert to 5.3 for a a few minutes to test to verify that it still works as you think it does in 5.3 Then you can rule out any code changes you have made or other inconsistencies and then you can chase down the correct issue.

    My code used to work months ago,

    are you certain the problem is php or is just a guess. Try php 5.3 to see if this specific error goes away.

    Pragmatism is all I have to offer. Avoiding the sidelines and providing centerline pro-tips.

Sign In or Register to comment.