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.

How do i autheticate vanilla users outside vanilla framework

AoleeAolee ✭✭
edited March 2011 in Vanilla 2.0 - 2.8
Hi guys

cant seem to find any thread related to my case but i found this one instead.

sorry this is a super old thread but its related to what i need

http://vanillaforums.org/discussion/3511/authenticating-a-vanilla-user-from-outside-the-vanilla-frameworks/p1

how do i do this in vanilla 2?

thanks in advance!

Comments

  • AoleeAolee ✭✭
    Thanks tester13 ill try it out tomorrow first thing in the morning. Btw i still owe you the front page thumbnail guide in the wiki page. Ill try to add it there too. Thanks so much!
  • I use this: https://gist.github.com/700805

    Paste your cookie salt from your config.php into that file and it doesn't even require calling up Vanilla. It's stand-alone.
  • @Lincoln
    Big thanks.
    I'll add your recipe to special page about authentification.
  • AoleeAolee ✭✭
    edited March 2011
    I use this: https://gist.github.com/700805

    Paste your cookie salt from your config.php into that file and it doesn't even require calling up Vanilla. It's stand-alone.
    Thanks lincon! :D i still need a lot of digging to really understand the internals of vanilla.

    I hope i can write a classified ads application (something like "open classifieds") someday for vanilla.
  • AoleeAolee ✭✭
    edited March 2011
    I use this: https://gist.github.com/700805

    Paste your cookie salt from your config.php into that file and it doesn't even require calling up Vanilla. It's stand-alone.

    Hi lincon,

    i tested it but the class doesn't return the Id,

    i did a print_r and it returned me the public variables instead
    VanillaIdentity Object ( [CookieName] => Vanilla [CookieSalt] => <value of salt here> [CookieHashMethod] => md5 )
    by the way i was getting a syntax error in line 10 so i changed

    class VanillaIdentity() {

    to

    class VanillaIdentity {
  • LincLinc Admin
    edited March 2011
    Fixt the parenthesis.

    Are you instantiating the class? It should be used as:

    $UserID = new VanillaIdentity();


    What the heck am I smoking. Updated. Do this:

    $Identity = new VanillaIdentity();
    echo $Identity->UserID;
  • AoleeAolee ✭✭
    edited March 2011
    hi lincon,

    sorry for the inconvenience...

    After i logged-in and went to the stand alone page (via another tab) it gave me 0 value?

    even if i change login in and do a refresh on the stand alone page it also gave me 0.

    thanks
  • You're on the same domain & subdomain?
  • AoleeAolee ✭✭
    edited March 2011
    Hi lincon,

    just got back from a vacation, the page is in sub.domain.com while the vanilla framework is in www.domain.com

    sub.domain.com docu root => /html/sub/
    www.domain.com docu root => /html/vanilla/

    by the way just a question

    since my page is a standalone page (without any PHP included files)

    where does the static call "Gdn_CookieIdentity::_HashHMAC" in the code comes from?
    protected static function _Hash($Data, $CookieHashMethod, $CookieSalt) { return Gdn_CookieIdentity::_HashHMAC($CookieHashMethod, $Data, $CookieSalt); }

    thanks :)
  • A typo. It should be self::_HashHMAC instead.

    They need to be on the same subdomain, or your forum needs to set all-subdomain cookies. (*.domain.com)
Sign In or Register to comment.