1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Getting xf_token

Discussion in 'XenForo Development Discussions' started by zekrose, Apr 15, 2015.

  1. zekrose

    zekrose Member

    Hello ! I would like to get the value of xf_token but I'm a beginneer with xenforo and I can't see how =) Could you help me to get it please ? Thanks ! =)

    More infos :
    I would like to get the RED VALUE
    <form action="account/toggle-visibility" method="post" class="AutoValidator visibilityForm">
    <input name="visible" value="1" class="SubmitOnChange" type="checkbox">Afficher en ligne
    <input name="_xfToken" value="17,1429131988,280947668325c2ff9264f57c1d639e272b2194c3" type="hidden">
  2. Jake B.

    Jake B. Well-Known Member

    You can just use: {$visitor.csrf_token_page}
  3. zekrose

    zekrose Member

    Hum, no because i use it from an external website.
    Sessions are the same(like a bridge, made by me) but the path is different from the forum path. So i need to get it by code
  4. Jake B.

    Jake B. Well-Known Member

    Ah, the token is generated with the following bit of code:
    $userId . ',' . XenForo_Application::$time. ',' . sha1(XenForo_Application::$time . $csrfToken);
    Where $userId = the user's ID (of course)

    and $csrfToken = the value of the csrf_token field in xf_user_profile

    How you get those will depend on how you setup your bridge, but that should be a good starting point.
  5. zekrose

    zekrose Member

    Thanks, it's all I need, i'm gonna try it =)

Share This Page