Created
December 12, 2011 10:57
-
-
Save chamerling/1466592 to your computer and use it in GitHub Desktop.
OAuth GitHub and Play!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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