This project has moved and is read-only. For the latest updates, please go here.

Valid Token Causes Invalid Token Exception

Topics: Developer Forum, User Forum
Apr 20, 2008 at 6:37 PM
Having sorted out the Uplaod issue and now fully understand the Authorisation technique, I cannot query anything as
I cannot get an Auth instance due to the following exception.

The Token is the same "Delete" authorised token I used to Upload a picture a few moments before. So, the Token must be valid??

Auth auth = flickr.AuthCheckToken(FlickrKeys.Token); // EXCEPTION HERE. "Invalid Auth Token (98)"

I really need help here as I'm on a tight deadline to get this working (academic not commercial). Any help is very welcome.
Many Thanks
Apr 21, 2008 at 3:19 PM
I've tested this at my end and it appears to work fine.

You are 100% sure that you are storing the Authentication Token, and not the Frob?
Apr 21, 2008 at 3:28 PM
Also, try creating your Flickr object with the Token:

Flickr flickr = new Flickr(FlickrKeys.Key, FlickrKeys.Secret, FlickrKeys.Token);

I'm not sure why that should work but it might make a difference.
Apr 21, 2008 at 4:14 PM
Another thing you can check, is to catch the exception, and then cut and past the flickr.LastRequest property into IE and double check that it has the correct API key and auth_token.
Apr 22, 2008 at 8:51 AM
Hold the front page! Just got all my code working by trying it on XP and not using Vista! Veru odd,
Apologies for taking up your time. I'll try and debug the issue and post any findings.

Apr 22, 2008 at 1:26 PM
Oh dear, another Vista only bug perhaps? Wonderful - time to install Virtual PC again...
Apr 24, 2008 at 2:53 PM
You only need to use AuthCheckToken to get the UserID for downloading a specific user so I did what you suggested and included the token in the constructor for the Flickr instance and then used PeopleFindByUsername. Works fine now on Vista and XP.

Flickr flickr = new Flickr(FlickrKeys.ApiKey, FlickrKeys.Secret, FlickrKeys.Token);
FoundUser user = flickr.PeopleFindByUsername("username");
PhotoSearchOptions options = new PhotoSearchOptions(user.UserId);
options.SortOrder = PhotoSearchSortOrder.DatePostedDesc;
options.PerPage = 1;
Photos photos = flickr.PhotosSearch(options);