play-authenticate icon indicating copy to clipboard operation
play-authenticate copied to clipboard

Redirection Ajax

Open gkielwasser opened this issue 10 years ago • 2 comments

Is it possible to make AJAX requests to login and to be able to retrieve eventuals errors? It seems that in your demo you are using PLAY_FLASH to retrieve errors in the redirection template.

even if I returns empty page for my AJAX request I'm unable to get the error which is stored in the PLAY_FLASH "cookie".

Any workaround?

thanks

gkielwasser avatar Sep 05 '13 15:09 gkielwasser

@gkielwasser did you have a look at: https://github.com/joscha/play-authenticate/pull/81 ?

joscha avatar Sep 06 '13 11:09 joscha

yep,

my current workaround is to read from the controller action the "flash" session which possibly contain error and return the appropriate reponse (ok() or badRequest(reason) instead of doing the redirection.

So when I do a login with AJAX, i bypass the redirection which is implemented in the core of play-authenticate and return the appropriate Json response.

However, it is not a clean solution..

gkielwasser avatar Sep 11 '13 16:09 gkielwasser