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

POST request responses are all "Unauthorized" #182

Closed
camilosampedro opened this issue Dec 20, 2016 · 1 comment
Closed

POST request responses are all "Unauthorized" #182

camilosampedro opened this issue Dec 20, 2016 · 1 comment

Comments

@camilosampedro
Copy link

I have this controller:

def amILoggedIn: Action[AnyContent] = StackAction(AuthorityKey -> Customer){ implicit request =>
    Ok("you are logged in")
}

When I send a GET request to my server after being logged, the response is a 200 "you are logged in". But when I send a POST request, the response is the default Play's "Unauthorized" HTML page:

Unauthorized
You must be authenticated to access this page.

My routes are:

GET         /logintest                         controllers.LoginTest.amILoggedIn
POST        /logintest                         controllers.LoginTest.amILoggedIn

It does not even check authority with the play2auth auth config, I suspect it is not recognizing the cookie that the client has after being logged in.

@camilosampedro
Copy link
Author

I'm sorry, I found the problem, it caused by the Play's CSRFFilter, it was necessary to use a CSRF token on post requests.

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

1 participant