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.
Options

JsConnect single-sign on not logging user into forum

petersg51petersg51 New
edited September 2012 in Vanilla 2.0 - 2.8

I can't seem to get jsconnect single sign-in to work. Here's what I've done so far:

1) Installed jsconnect plugin
http://vanillaforums.org/addon/jsconnect-plugin

2) Installed autosignin plugin
http://vanillaforums.org/addon/jsconnectautosignin-plugin

3) Downloaded and hooked up jsconnect client lib
http://vanillaforums.com/blog/help/implementing-jsconnect-single-signon-on/

4) Tried test mode and got back what looks like the correct info. Eg, clicking on "test" in the forum admin panel for jsconnect, it returns:
test(test({"email":"peter.g@gmail.com","name":"Peter G","photourl":"","uniqueid":"5603369d51a5","client_id":"14400405","signature":"9bf282dd573d3462111899ae02341466"}));

(not sure why there are 2 "test"s here??)

5) I login to my main site.

Then I go to the vanilla forum. From Firebug Net panel, I see the forum making this call:

http://www.mysitehere.com/api/auth/vanillaSSO?client_id=14400405&Target=/&callback=jQuery1620017708424549528923_1348168408911&_=1348168409108

With this response:

jQuery1620017708424549528923_1348168408911(jQuery1620017708424549528923_1348168408911({"name":"Peter G","photourl":""}));

This all seems correct, but I don't get auto signed-in to the forum.

6) Reverted back to test mode:
In jsconnect client code:
Set $secure = false;
In jsconnect admin settings:
Checked box for "This connection is in test-mode."

Response in Firebug is now:
jQuery162007684746542901_1348170491179(jQuery162007684746542901_1348170491179({"email":"peter.g@gmail.com","name":"Peter G","photourl":"","uniqueid":"541eed78-ef26-488f-846c-5603369d51a5","client_id":"14400405","signature":"9bf282dd573d3462111899ae02341466"}));

Am I missing any configurations or steps?

Thanks,

Peter

ps -- apologies if this is a double

Comments

  • Options
    ToddTodd Chief Product Officer Vanilla Staff

    The auto-login is @x00 's plugin.

  • Options

    A lot for this is dependent on theme. it requires the guest module.

    Do you have a link?

    grep is your friend.

  • Options

    Does jsconnect plugin require the jsconnectautosignin plugin (for the use-case I described)? That was my impression reading the thread mentioned in my first post.

    I'll try installing the guest module to see if that fixes things.

  • Options
    HalfCatHalfCat ✭✭
    edited September 2012

    @petersg51 said:
    Does jsconnect plugin require the jsconnectautosignin plugin (for the use-case I described)? That was my impression reading the thread mentioned in my first post.

    The jsconnectautosignin plugin is not required for the jsconnect to work. It just adds additional functionality by logging the user in as soon as he visits your forum.

  • Options
    petersg51petersg51 New
    edited September 2012

    OK. So that's basically our desired use case. To be clear:

    1) User logs on to our main site

    2) User visits Vanilla forum associated with our site, and is automatically logged in (thus "single-sign-on")

    I've installed jsconnect plugin & client, and jsconnectautosignin.

    Is the guest module really required? When I do a search on the plugin page for "guest" I get 3 results:

    o Guest Default Route

    o Guest Restriction - How to Write A Plugin - with message added

    o Force Guest Sign In

    Which one is required? Why is this needed???

    Can anyone offer suggestions on how to debug this? My understanding is that the forum is requesting the SSO data from the client and is getting it, but for some reason it's not acting on it.

    From firebug net console (in test mode):

    REQUEST:
    http://devapp.example.com/api/auth/vanillaSSO?client_id=14400405&Target=/&callback=jQuery162044610980888441054_1348247863198&_=1348247863556

    RESPONSE:
    jQuery162044610980888441054_1348247863198(jQuery162044610980888441054_1348247863198({"email":"peter.xxxxxx@gmail.com","name":"Peter G","photourl":"","uniqueid":"541eed78-ef26-488f-846c-5603369d51a5","client_id":"14400405","signature":"9bf282dd573d3462111899ae02341466"}));

    So shouldn't it match the email here to the user in the Vanilla user DB table and sign in from there?

    Thx,

    Peter

    @x00 said:
    A lot for this is dependent on theme. it requires the guest module.

    Do you have a link?

  • Options

    if you are not seeing the name come up in the side panel, with just jsConnect, you don't have the guest module enabled.

    No it it does not sign it with just the name an email, that would lax, it needs credentials. It is a three step dance.

    It looks to me like you are only getting credential in test mode, unless I misinterpreted.

    AutoSignIn takes the the first user, from the side panel, gets the ConnectUrl, with its own api. /entry.js/jsconnectauto?client_id=, retrieves the JsAuthenticateUrl ,get back credentials, simulates a form, and submits it.

    If there are an error at this stage it will automatically take you to a error page.

    This is the dance so to speak. Without a link can't say.

    grep is your friend.

  • Options
    edited October 2012

    What is the "guest module", where do you get the "guest module", and where do you put the "guest module" so that the jsconnectAutoSignIn plugin will work?

    I believe this is the same questions that @petersg51 needed answered too.

  • Options
    x00x00 MVP
    edited October 2012

    The guest module is what is normally shown in the side bar, give option to sign on. If you don't have a side bar you probably don't have the guest module.

    Make sure you get jsConnect to work first, before adding auto sign on.

    grep is your friend.

  • Options

    So, if I don't have the side bar, where do I get the "guest module", and where do I put the "guest module" after I get it?

  • Options

    what is the reason for not having the side bar?

    grep is your friend.

  • Options

    Side bar offers no benefit other than taking up space and adding noise to the UI. But then that is all just my opinion. The question I'd like to ask though, is, why won't anyone just say where to get the guest module and where to put it? Why is this question being completely avoided?

  • Options

    EGT, wondering if you were able to solve this problem. I have similar problems with SSO. It's complex.

  • Options

    @evilgeniustweet

    I'm not avoiding your question, but I'm not doing development for you, and I'm not on call.

    http://vanillaforums.org/docs/modules

    you can add

    $this->AddModule('GuestModule');

    in your master template. Or if you are using smarty template.

    {module name='GuestModule'}

    You can also use theme hooks in an appropriate hooks

    $Sender->AddModule('GuestModule');

    You can then style it or hide it with css.

    In later version I will do it somewhat differently, but I don't have time now.

    if this is not something you can do I’m sorry I can't offer more assistance than that.

    grep is your friend.

  • Options

    @djcher, I am sorry, I haven't. I'm not sure a solution with be forthcoming.

  • Options

    @x00 thank you for your input so far, but... please understand that no where in this thread have I asked you or anyone else to do any development. I have only asked a very, very simple question, and I'm not sure how much simpler I can ask the question to get an actual answer.

    FYI, your reference "http://vanillaforums.org/docs/modules" is completely outdated, the same as much of vanilla's documentation. In the version of vanilla that I am using, 2.0.18, there is no "/applications/garden/modules" folder, simply because there is no "/applications/garden" folder. There also is no guest module in the "/applications/vanilla/modules" folder.

    So I'm kinda left still asking the same question...

    "where do I get the guest module?"
    (as in where do I find it, or where do I download it from the vanilla website?)

    And then of course "where do I put the "guest module" after I get it?
    (as in, once I download the guest module, where exactly do I put it (what folder) so that the jsconnect SSO plugin will work?)

    If you just didn't want to answer the question, a simple "I don't want to answer the question" would have been a perfect response and would have saved everyone reading or writing this thread a lot of wasted time, and eliminated what ever caused you to feel that you were being put "on call". That certainly was not my intention.

    And finally, before I am flamed for anything I've written above, if this forum is not intended for new people or people outside of the "cliq" to ask questions and maybe get some help, perhaps that should be clarified so that us new people and outsiders don't waste yours or our time... just a harmless suggestion.

  • Options
    x00x00 MVP
    edited October 2012

    @evilgeniustweet. The guest module code is in the dashboard application rather than vanilla (something that is somewhat of an intellectual curiosity), I explained how to add module. where you add it is up to you. I suggest you add it in a theme hook

    create inside you theme a file called class.modsthemehooks.php and in it place

    <?php if (!defined('APPLICATION')) exit();
    class ModsThemeHooks extends Gdn_Plugin{
        public function Base_Render_Before($Sender){
            $Sender->AddModule('GuestModule','Foot');
        }
    }
    

    The module will appear in the foot. That is development.

    You do realise that this is an independent plugin nothing to do with with a clique? If the jsConnect plugin is not working then jsConnect Auto Sign will not work, I stated that quite clearly. They are separate concerns. You addressed my plugin, I gave you advice, if you are catty about it is not my problem. It comes as is.

    The jsConnect pluign places the option to logon under one user, or theoretically multiple in the guest module, I pick up from there, that by design. If there is no guest module it will not function as expected.

    grep is your friend.

  • Options

    @x00 thank you! I will play with this and see if I can get it to work. Once again, thank you.

  • Options
    businessdadbusinessdad Stealth contributor MVP

    I had a similar issue when I developed an extension for Magento to work with Vanilla JsConnect. I solved it by returning "callback" together with the other parameters. That would mean returning something like this:

    {
       "email":"peter.xxxxxx@gmail.com",
       "name":"Peter G",
       "photourl":"",
       "uniqueid":"541eed78-ef26-488f-846c-5603369d51a5",
       "client_id":"14400405",
       "callback":"http://someurl",
       "signature":"9bf282dd573d3462111899ae02341466"
    }
    

    Of course, signature would recalculated taking the new parameter into account. I hope it helps.

Sign In or Register to comment.