How can I extend my form with csrf token properly?

bitli

I use Play2! Scala 2.3.8. I would like to add a default csrfToken for my from, but I do know how. I tried it by this example https://www.playframework.com/documentation/2.3.8/ScalaCsrf

I created a custom global object and I extended my form with :

@helper.form(action = routes.Books.submitBook) {
@helper.CSRF.formField

but I got this error after I had sent the form :

could not find implicit value for parameter token: play.filters.csrf.CSRF.Token

I know CSRF.formField need a parameter, but the example does not contain.

kosii

The documentation states the following:

The form helper methods all require an implicit token or request to be available in scope. This will typically be provided by adding an implicit RequestHeader parameter to your template, if it doesn’t have one already.

In order to do that, you have to change your template's parameter list to like this:

@(<your parameters>)(implicit request: RequestHeader)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How can I extend my form with csrf token properly?

From Dev

Flask-wtf: csrf_token is removed from session before I can POST my form

From Dev

How can I configure Spring Security to process a CSRF token in a multipart/form-data (POST) request?

From Dev

How can I check what csrf token is my rails controller expecting?

From Dev

How can I extend my LVM partition

From Dev

How can I get a CSRF token from the command line?

From Dev

How can I add a csrf token on a http request in python?

From Dev

I can't extend Form

From Dev

How can I properly align my labels?

From Dev

how to add a csrf token to a fake symfony form

From Dev

How can I extend image height to fit my whole screen?

From Dev

How can I extend my functionality to also have the cd command?

From Dev

Why is my CSRF token empty when using Form::open()?

From Dev

Where should I put my CSRF token in my Ember app?

From Dev

How can I center this datepicker in my form?

From Dev

How can I align my form the left

From Dev

How can I drag jqgrid edit form properly?

From Dev

How can I get the headers to align properly with the columns of the form?

From Dev

With Spring Security 3.2.0.RELEASE, how can I get the CSRF token in a page that is purely HTML with no tag libs

From Dev

How can I use ring anti-forgery / CSRF token with latest version ring/compojure?

From Dev

With Spring Security 3.2.0.RELEASE, how can I get the CSRF token in a page that is purely HTML with no tag libs

From Dev

How can I achieve a single CSRF token across multiple forms in Symfony 2?

From Dev

How can I extend CachedDataAnnotationsModelMetadataProvider?

From Dev

How can I get my coloured Bootstrap popover to render properly?

From Dev

How can I make my Javascript always submit properly?

From Dev

How can I properly import a Component into my Navigator in React Native?

From Dev

How can I test that my async process is submitted properly?

From Dev

How can I change my list into string properly?

From Dev

How can I properly setup Google Analytics in my Vue website?

Related Related

  1. 1

    How can I extend my form with csrf token properly?

  2. 2

    Flask-wtf: csrf_token is removed from session before I can POST my form

  3. 3

    How can I configure Spring Security to process a CSRF token in a multipart/form-data (POST) request?

  4. 4

    How can I check what csrf token is my rails controller expecting?

  5. 5

    How can I extend my LVM partition

  6. 6

    How can I get a CSRF token from the command line?

  7. 7

    How can I add a csrf token on a http request in python?

  8. 8

    I can't extend Form

  9. 9

    How can I properly align my labels?

  10. 10

    how to add a csrf token to a fake symfony form

  11. 11

    How can I extend image height to fit my whole screen?

  12. 12

    How can I extend my functionality to also have the cd command?

  13. 13

    Why is my CSRF token empty when using Form::open()?

  14. 14

    Where should I put my CSRF token in my Ember app?

  15. 15

    How can I center this datepicker in my form?

  16. 16

    How can I align my form the left

  17. 17

    How can I drag jqgrid edit form properly?

  18. 18

    How can I get the headers to align properly with the columns of the form?

  19. 19

    With Spring Security 3.2.0.RELEASE, how can I get the CSRF token in a page that is purely HTML with no tag libs

  20. 20

    How can I use ring anti-forgery / CSRF token with latest version ring/compojure?

  21. 21

    With Spring Security 3.2.0.RELEASE, how can I get the CSRF token in a page that is purely HTML with no tag libs

  22. 22

    How can I achieve a single CSRF token across multiple forms in Symfony 2?

  23. 23

    How can I extend CachedDataAnnotationsModelMetadataProvider?

  24. 24

    How can I get my coloured Bootstrap popover to render properly?

  25. 25

    How can I make my Javascript always submit properly?

  26. 26

    How can I properly import a Component into my Navigator in React Native?

  27. 27

    How can I test that my async process is submitted properly?

  28. 28

    How can I change my list into string properly?

  29. 29

    How can I properly setup Google Analytics in my Vue website?

HotTag

Archive