key,shared,
new REST()
);
final RequestContext context = RequestContext.getRequestContext();
//ask user to authenticate on the web
final AuthInterface authInterface = flickr.getAuthInterface();
try {
frob = authInterface.getFrob();
} catch (FlickrException e) {
e.printStackTrace();
}
System.out.println("frob: " + frob);
final URL url = authInterface.buildAuthenticationUrl(Permission.DELETE, frob);
System.out.println("Press return after you granted access at this URL:");
System.out.println(url.toExternalForm());
final Stage stage = Stage.createStage();
stage.setContent(
new GridBox()
.createColumn(50,GridBox.Align.Right)
.createColumn(50,GridBox.Align.Fill)
.addControl(new Label("Please visit Flickr and grant Leo access to your account"))
.nextRow()
.addControl(new Spacer())
.addControl(new Button("Goto Flickr").onClicked(new Callback<ActionEvent>() {
public void call(ActionEvent event) {
OSUtil.openBrowser(url.toExternalForm());
}
}))
.nextRow()
.addControl(new Button(getString("dialog.cancel")).onClicked(new Callback<ActionEvent>(){
public void call(ActionEvent event) {
stage.hide();
}
}))
.addControl(new Button("Continue >").onClicked(new Callback<ActionEvent>(){
public void call(ActionEvent event) {
stage.hide();
try {
Auth auth = authInterface.getToken(frob);
System.out.println("Authentication success");
// This token can be used until the user revokes it.
System.out.println("Token: " + auth.getToken());
String user_token = auth.getToken();
ChangeFlickrSettingsAction.this.context.getSettings().setProperty(FLICKR_USER_TOKEN,user_token);