Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Needed to configure generate_csrf_token #117

Open
tslocke opened this issue Dec 20, 2016 · 3 comments
Open

Needed to configure generate_csrf_token #117

tslocke opened this issue Dec 20, 2016 · 3 comments

Comments

@tslocke
Copy link

tslocke commented Dec 20, 2016

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 : )

@MaxPleaner
Copy link
Contributor

@tslocke where exactly do you put this?

@rcdilorenzo
Copy link

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

@AvaelKross
Copy link
Contributor

AvaelKross commented Mar 4, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants