Answers.Body: <p>In Craft 3 the csrf token validation in the <code>general.php</code> config is set to true by default. In order to request your controller with post requests you have to turn it off or include the token</p>
  
  <p><a href="https://docs.craftcms.com/v3/changes-in-craft-3.html#csrf-token-params" rel="nofollow noreferrer">https://docs.craftcms.com/v3/changes-in-craft-3.html#csrf-token-params</a></p>
  
  <pre><code>{% set csrfTokenName = craft.app.config.general.csrfTokenName %}         
  {% set csrfToken = craft.app.request.csrfToken %}     
  &lt;input type="hidden" name="{{ csrfTokenName }}" value="{{ csrfToken }}"&gt;
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-04T20:50:59.473Z
Answers.Text: this doesn't really answer my question
Answers.UserDisplayName: User
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-04T21:04:48.313Z
Answers.Text: Seems like I missunderstood it. I thought it was about not being able to access it via POST request
Answers.UserDisplayName: Robin Schambach
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-04-04T20:37:21.433Z
Answers.LastActivityDate: 2018-11-02T18:48:27.347Z
Answers.LastEditDate: 2018-11-02T18:48:27.347Z
Answers.UserDisplayName: Robin Schambach
Body: <p>I have a controller which is eventually going to be set up for POSTs and GETs, but the weird thing is I can only access it through <code>localhost/index.php?p=actions/twoFA/get</code> where twoFA is my plugin handle and get is an action method in my controller. How can I make it so that it behaves like all the examples online where I could go to <code>localhost/actions/twoFA/get</code>? What's happening? Also, my <code>actionTrigger</code> is set to <code>actions</code> and I have not set up any site routes in my plugin.</p>
  
  <p>UPDATE: I have decided to make this work a little differently, and I therefore do not need any help.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-04-04T22:29:50.327Z
Comments.Text: Went ahead and voted to close as OP stated it's no longer valid.
Comments.UserDisplayName: Brad Bell
Tags: <plugin-development><request><elementaction>
Title: How should I fix an odd action URL?
ThreadText: # How should I fix an odd action URL?
  
  (Asked by: username_0 on 2018-04-04)
  
  I have a controller which is eventually going to be set up for POSTs and GETs, but the weird thing is I can only access it through `localhost/index.php?p=actions/twoFA/get` where twoFA is my plugin handle and get is an action method in my controller. How can I make it so that it behaves like all the examples online where I could go to `localhost/actions/twoFA/get`? What's happening? Also, my `actionTrigger` is set to `actions` and I have not set up any site routes in my plugin.
  
  UPDATE: I have decided to make this work a little differently, and I therefore do not need any help.
  
  **Tags:** plugin-development, request, elementaction
  
  > **Comments:**
  > **username_1**: Went ahead and voted to close as OP stated it's no longer valid.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2018-04-04. Score: 1
  
  In Craft 3 the csrf token validation in the `general.php` config is set to true by default. In order to request your controller with post requests you have to turn it off or include the token
  
  <https://docs.craftcms.com/v3/changes-in-craft-3.html#csrf-token-params>
  
  ```
  {% set csrfTokenName = craft.app.config.general.csrfTokenName %}         
  {% set csrfToken = craft.app.request.csrfToken %}     
  <input type="hidden" name="{{ csrfTokenName }}" value="{{ csrfToken }}">
  
  ```
  
  > **Comments:**
  > **username_0**: this doesn't really answer my question  
  > **username_2**: Seems like I missunderstood it. I thought it was about not being able to access it via POST request  
  
  ---
  
  