Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
OAuth GitHub and Play!
/**
* Github call this as callback
*/
public static void callback(String code) {
System.out.println("Just get code from github : " + code);
WSRequest request = WS
.url("https://github.com/login/oauth/access_token");
request.setParameter("client_id", CLIENT_ID);
request.setParameter("client_secret", CLIENT_SCRET);
request.setParameter("code", code);
System.out.println("Trying to get oauth from github...");
play.libs.WS.HttpResponse response = request.post();
System.out.println("Response status = " + response.getStatus());
System.out.println("Response body = " + response.getString());
String oauth = "quickhubapp://oauth?" + response.getString();
render(oauth);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment