joscha / play-authenticate

An authentication plugin for Play Framework 2.x (Java)
http://joscha.github.com/play-authenticate/
Other
807 stars 366 forks source link

Is it possible to return JSON response? #196

Open tanmaydesai89 opened 10 years ago

tanmaydesai89 commented 10 years ago

Greetings.

I wanted to know if it is possible to send response as JSON. I don't want to render scala for front-end. For example, when I send form data with post request on mydomain.com/signup, is it possible that JSON data can be returned?

joscha commented 10 years ago

did you have a look at the sample and check if you can modify the templates according to your needs?

tanmaydesai89 commented 10 years ago

Hi @joscha : I am not much of a java guy, but PlayAuthenticate returns Result. Can you point me to the right direction. Struggling to find way since yesterday. I need to use this module for Android app.

joscha commented 10 years ago

Result is generated from a twirl template. Twirl templates can have any format. If you change Globals.java to use your own routes with Twirl templates that return JSON it should work.

keepscoding commented 9 years ago
 public static Result index() {
           return ok( Json.toJson ("output your Json"));
    }