Skip to content
This repository has been archived by the owner on Sep 10, 2024. It is now read-only.

4.0.0.RC1 Grails Incompatible - Server returned 403: CSRF token doesn't match. #71

Open
codeconsole opened this issue May 4, 2019 · 7 comments

Comments

@codeconsole
Copy link

codeconsole commented May 4, 2019

The plugin does not work with Grails 4.0.0.RC1

Executing a script results in the following message:
Server returned 403: CSRF token doesn't match. Please refresh the page.

Setup:

sdk use grails 4.0.0.RC1
grails create-app demo
cd demo
# add runtime 'org.grails.plugins:grails-console:2.1.1' to build.gradle
grails run-app

visit: http://localhost:8080/console/index#new
and hit the play button/execute a script.

@sheehan
Copy link
Owner

sheehan commented May 9, 2019

I just tested and it seems to be working for me. Does it work for you after a page refresh?

@codeconsole
Copy link
Author

Refresh has no impact. Interestingly, it will work in an incognito window.

Strange, I just tested 3.3.9 and it doesn't work either so I guess this isn't related to Grails 4.

I am using Chrome 74.0.3729.131 on Mac OS Mojave 10.14.4

This used to work fine. Not sure what is going on here. Any ideas?

@codeconsole
Copy link
Author

Safari works fine.

@codeconsole
Copy link
Author

Any ideas on what might be causing the issue in Chrome? I tried disabling all my extensions. Still doesn't work. Weird that it works in incognito mode.

@sheehan
Copy link
Owner

sheehan commented May 9, 2019

Strange. It works for me in Chrome (same Chrome and Mac version). Does it work if you set
grails.plugin.console.csrfProtection.enabled = false

@codeconsole
Copy link
Author

yes, and like I said, the csrfProtection works fine in an incognito window. Anything I can reveal by inspecting the headers?

@sheehan
Copy link
Owner

sheehan commented May 9, 2019

The execute call should send a X-CSRFToken header that matches what's stored in the session.

https://github.com/sheehan/grails-console/blob/master/grails3/plugin/grails-app/controllers/org/grails/plugins/console/TokenInterceptor.groovy#L14

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

No branches or pull requests

2 participants