public class OAuthClientTest {
public static void main(String[] args) throws OAuthSystemException, IOException {
try {
OAuthClientRequest request = OAuthClientRequest
.authorizationProvider(OAuthProviderType.FACEBOOK)
.setClientId("131804060198305")
.setRedirectURI("http://localhost:8080/")
.buildQueryMessage();
//in web application you make redirection to uri:
System.out.println("Visit: " + request.getLocationUri() + "\nand grant permission");
System.out.print("Now enter the OAuth code you have received in redirect uri ");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String code = br.readLine();