// Goes online to get user authentication from Flickr. public void getAuthentication() { AuthInterface authInterface = flickr.getAuthInterface(); try { frob = authInterface.getFrob(); } catch (Exception e) { e.printStackTrace(); } try { URL authURL = authInterface.buildAuthenticationUrl(Permission.WRITE, frob); // open the authentication URL in a browser open(authURL.toExternalForm()); } catch (Exception e) { e.printStackTrace(); } println("You have 15 seconds to approve the app!"); int startedWaiting = millis(); int waitDuration = 15 * 1000; // wait 10 seconds while ((millis() - startedWaiting) < waitDuration) { // just wait } println("Done waiting"); try { auth = authInterface.getToken(frob); println("Authentication success"); // This token can be used until the user revokes it. token = auth.getToken(); // save it for future use saveToken(token); } catch (Exception e) { e.printStackTrace(); } // complete authentication authenticateWithToken(token); }