addict icon indicating copy to clipboard operation
addict copied to clipboard

Needed to configure generate_csrf_token

Open tslocke opened this issue 7 years ago • 3 comments

On a fresh install I was getting invalid CSRF errors when submitting the login form.

It turned out config.generate_csrf_token was nil, and addict was rendering a blank value in the CSRF hidden form field.

The fix was to add

generate_csrf_token: (fn -> Phoenix.Controller.get_csrf_token end)

to my config.

As this isn't mentioned in the docs, this could be a bug I guess, or (more likely) there may be something screwy elsewhere in my config?

Posting mainly for the benefit of others who may hit this. For my part it's working and I'm moving on : )

tslocke avatar Dec 20 '16 11:12 tslocke

@tslocke where exactly do you put this?

MaxPleaner avatar Jan 27 '17 01:01 MaxPleaner

@MaxPleaner This would go in your :addict config in the config.exs.

rcdilorenzo avatar Jan 27 '17 03:01 rcdilorenzo

It fails on mix release if I add this string. I had similar issue before: #70 Looks like config.exs isn't a good place for functions.. Though I'm not sure and will appreciate any clarifications on this.

AvaelKross avatar Mar 04 '17 07:03 AvaelKross