<p>My bad - sorted it out by adding {{ getCsrfInput() }} - as per <a href="https://craftcms.com/support/csrf-protection" rel="nofollow noreferrer">https://craftcms.com/support/csrf-protection</a></p>

CC BY-SA 3.0
2017-06-23T09:52:23.790Z
2017-06-23T09:52:23.790Z
Redbloc
<p>I've been following the Craft Commerce tutorials at Mijingo, (running on CraftPro 2.6.2983) all good so far, except when I go add a product to my cart. I'm getting a "CSRF token could not be found" error.</p>

<p>The debug message with dev mode on reads:</p>

<blockquote>
  <p>Warning: Declaration of Craft\UserSessionService::login($username, $password, $rememberMe = false) should be compatible with CWebUser::login($identity, $duration = 0) in /Users/username/projectname/craft/app/services/UserSessionService.php on line 17</p>
  
  <p>Warning: Declaration of Craft\UserSessionService::afterLogin() should be compatible with CWebUser::afterLogin($fromCookie) in /Users/username/projectname/craft/app/services/UserSessionService.php on line 17</p>
</blockquote>

<p>Is there a step or setup option I'm missing? Atm, it's running on Mamp, but I want to make sure it's workable before I license up and go live. </p>

CC BY-SA 3.0
2017-06-21T20:40:30.333Z
Glad you got it sorted!  Would you mind adding your edit as an official answer in case someone else runs into it in the future?
Brad Bell
<plugin-craftcommerce>
Craft Commerce - Bad Request The CSRF token could not be verified
# Craft Commerce - Bad Request The CSRF token could not be verified

(Asked by: username_0 on 2017-06-21)

I've been following the Craft Commerce tutorials at Mijingo, (running on CraftPro 2.6.2983) all good so far, except when I go add a product to my cart. I'm getting a "CSRF token could not be found" error.

The debug message with dev mode on reads:

> Warning: Declaration of Craft\UserSessionService::login($username, $password, $rememberMe = false) should be compatible with CWebUser::login($identity, $duration = 0) in /Users/username/projectname/craft/app/services/UserSessionService.php on line 17
>
> Warning: Declaration of Craft\UserSessionService::afterLogin() should be compatible with CWebUser::afterLogin($fromCookie) in /Users/username/projectname/craft/app/services/UserSessionService.php on line 17

Is there a step or setup option I'm missing? Atm, it's running on Mamp, but I want to make sure it's workable before I license up and go live.

**Tags:** plugin-craftcommerce

> **Comments:**
> **username_1**: Glad you got it sorted!  Would you mind adding your edit as an official answer in case someone else runs into it in the future?  

---

## 1 answers

### Answer by username_0 on 2017-06-23. Score: 4

My bad - sorted it out by adding {{ getCsrfInput() }} - as per <https://craftcms.com/support/csrf-protection>


---

