I'm using the Flickrj API to log into flickr. For READ only access its fine, but I can't seem to correctly auth when i need WRITE access to add tags to photos.
As i understand the basic auth flow
- Get a frob
- Pass that frob requesting WRITE access, this returns a URL.
- Call the URL to recieve a flickr token
- Use the token in all subsequent requests
My code currently is
Flickr f = new Flickr(properties.getProperty(APIKEY),properties.getProperty(SECRET),t);
System.out.println(f.toString());
// 1 get a frob
AuthInterface authInterface = f.getAuthInterface();
String frob = authInterface.getFrob();
System.out.println("first frob "+frob);
// 2 get a request URL
URL url = f.getAuthInterface().buildAuthenticationUrl(Permission.WRITE,frob);
System.out.println(url.toString());
// 3 call the auth URL
// 4 get token
f.getAuthInterface().getToken(frob);
As you can see - i'm stuck on step 3?
I found this code de.elmar_baumann.jpt.plugin.flickrupload.Authorization. After step 2 the trick is to have the java desktop app open a browser window and a dialog. Once the user has logged in via the browser, they click the dialog so step four can be called and the token retrieved.