简体   繁体   中英

Flickr/flickrj: how to get user information after user clicks on web-app?

I'm writing a Java web-app that I created a Flickr-app for.

If a Flickr-user registers my app he/she is automatically sent to the URL I entered in Flickr's authentication flow of the app. Along with that I receive a parameter frob . I can use that one to get the Flickr's user-id of that particular user:

flickrId = flickrj.getAuthInterface().getToken(frob).getUser().getId();

So that works fine.

However, if he/she uses the screen "Apps You're Using" and clicks on my app I don't get any information about the user as far as I can tell. Nonetheless, if I use flickrj like

frob = flickrj.getAuthInterface().getFrob();

I get a frob like 7x1x7x2x2x8x1x1x0-48x9f1xfdbx8ex9d-x00x5x9 (note that I x-ed some numbers), whatever that frob is supposed to be. If I then use that frob on

flickrId = flickrj.getAuthInterface().getToken(frob).getUser().getId();

I run into a

com.aetrion.flickr.FlickrException: 108: Invalid frob
    at com.aetrion.flickr.auth.AuthInterface.getToken(AuthInterface.java:182)
    :

What do I need to do to get information about Flickr's currently logged in user? I had hoped to find something like a place-holder I can use in that URL or Flickr automatically sends some parameter, but I couldn't find information about this.

After some more trial and error I simply use the permission URL that flickrj creates.

String frob = flickrj.getAuthInterface().getFrob();
return "redirect:" + flickrj.getAuthInterface().buildAuthenticationUrl(Permission.READ, frob);

This calls the URL I entered in Flickr's authentication flow of the app. The only problem is to distinguish from such a request to when the user came in from Flickr's authorization form.

But that's another story...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM