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

How to check Login?

This discussion is related to the Vanilla jsConnect addon.
PHPAdamPHPAdam New
edited September 2014 in Vanilla 2.0 - 2.8

I have website on root; and forum on /talk/

jsConnectPHP is in place.

Yet no documentation?

I've set it up so to login; users are sent to forum. They login and are reffered back to the main website (great!).

Now im on the main website; how do I check the user is logged in? ...

I can see the session and cookie data is there; how to use it is the question?

All im realy trying to do is; use session or cookie data. Cross check it with database? I presume this is what JSCOnnect can do? ..

Comments

  • hgtonighthgtonight ∞ · New Moderator

    Welcome to the community!

    Are you looking to use Vanilla sessions as your site session?

    Or are you looking to start a Vanilla session with your site session?

    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.

    Bleistivt
  • PHPAdamPHPAdam New
    edited September 2014

    Thank you for the warm welcome.

    I am looking to use Vanilla sessions as my site session.

    Currently users are sent to forum logn page, via a link: mainsite.com/talk/entry/signin?Target=http://mainsite.com

    Therefore redirected back to main website. So looking to check user is logged in on the main website, via checking the sessions Vanilla forum set.

  • hgtonighthgtonight ∞ · New Moderator

    You can get the current user by doing an AJAX request for their profile via http://mainsite.com/talk/profile.json. This will return either the signed in user and their profile data, or an exception object.

    If your site is small or you are creating your web application yourself, I would suggest running your site inside of the Garden framework.

    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.

    PHPAdam
  • If you only need the UserID, you could use this:
    https://gist.github.com/lincolnwebs/700805

    $VanillaIdentity = new VanillaIdentity();
    $VanillaUserID = $VanillaIdentity->GetLoggedUserID();
    

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

    • Vanilla APP » Learn more «
    • iOS & Android App for Vanilla - White label app for your forum
    PHPAdam
  • PHPAdamPHPAdam New
    edited October 2014

    @hgtonight‌ I need it server side. I could not figure out a "safe/secure" way to use what you suggest with the users AJAX feeding back to mainsite. Could be easily fudged.... That being said; I am going to use it! (not for authentication) now you have brought it to my attention.

    I looked at the Garden Framework (im using codeigniter) but not much documentation and im reliant on the CodeIgniter Docs as it is.

    @Bleistivt I used a different one that was mentioned in the comments. Your link did not have GetLoggedUserID.

    I am using codeigniter - so a quick play around adding it as a Library, figuring out has to pass perimeters (name, salt, hashmethod) and it works!!!
    I thank you very much!

    You are both great; again thanks.

    Bleistivthgtonight
Sign In or Register to comment.