# CSRF values are empty

**URL:** <https://discourse.slimframework.com/t/csrf-values-are-empty/4212>\
**Category:** Questions\
**Created:** [June 5, 2020, 8:36pm UTC](https://discourse.slimframework.com/t/csrf-values-are-empty/4212 "2020-06-05T20:36:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Awilum](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/awilum/32/900_2.png) [@Awilum](https://discourse.slimframework.com/u/Awilum)\
**Post date:** [June 5, 2020, 8:36pm UTC](https://discourse.slimframework.com/t/csrf-values-are-empty/4212/1 "2020-06-05T20:36:32Z")

</div>

I am using

“slim/csrf”: “~0.8.3” and “slim/slim”: “~3.12.3” and my custom twig function for this

> <https://github.com/flextype-plugins/twig/blob/master/twig/CsrfTwigExtension.php>

I am trying to understand why values are empty on my page

```auto
<input type="hidden" name="csrf_name" value="">
<input type="hidden" name="csrf_value" value="">

```

Session was started in the app but this values are empty for some reason.  
Any ideas ?

---

<div class="post-metadata">

**Author:** ![Awilum](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/awilum/32/900_2.png) [@Awilum](https://discourse.slimframework.com/u/Awilum)\
**Post date:** [June 5, 2020, 9:03pm UTC](https://discourse.slimframework.com/t/csrf-values-are-empty/4212/2 "2020-06-05T21:03:05Z")

</div>

this method returns **null**

but why ?

```auto
    /**
     * @return string
     */
    public function getTokenName()
    {
        return isset($this->keyPair[$this->getTokenNameKey()]) ? $this->keyPair[$this->getTokenNameKey()] : null;
    }

    /**
     * @return string
     */
    public function getTokenValue()
    {
        return isset($this->keyPair[$this->getTokenValueKey()]) ? $this->keyPair[$this->getTokenValueKey()] : null;
    }

```

---

<div class="post-metadata">

**Author:** ![Awilum](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.slimframework.com/awilum/32/900_2.png) [@Awilum](https://discourse.slimframework.com/u/Awilum)\
**Post date:** [June 5, 2020, 9:10pm UTC](https://discourse.slimframework.com/t/csrf-values-are-empty/4212/3 "2020-06-05T21:10:58Z")

</div>

okey, issue founded and fixed 🙂

```auto
$app->add($flextype->get('csrf'));

```

this code I forget to add in my app
