Can someone post code showing WinRT authentication

Topics: Developer Forum
Jul 29, 2013 at 8:37 PM
I am currently trying to get this library to work with a WinRT application and have been banging my head on the wall for weeks on and off. I am trying to figure out how to authenticate to Flickr so I can get authenticated photos back (personal, contacts, groups, etc) and to be able to do the things that require authentication. Nothing really spells it out and I am having very little luck cobbling anything together from what is available on the web. I can get back non-authenticated items fine. It just seems that I am missing the secret element to get the auth portion to work right. Any help would be greatly appreciated and seriously help my sanity. Thanks.

Aug 6, 2013 at 8:02 AM
Have you looked at these:

The latter one obviously goes into details of how to get the request token, which the FlickrNet library does for you, but hopefully the rest should be easy.

Aug 14, 2013 at 7:00 PM
Aug 22, 2013 at 4:45 AM
Edited Aug 22, 2013 at 4:45 AM
vmrocha...thanks for the post. That got me most of the way there. Just had to add a couple things like the GetTimeStamp() function for turning datetime to Unix time.
private string GetTimeStamp()
            TimeSpan ts = (DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0));
            int unixtime = (int)ts.TotalSeconds;
            return unixtime.ToString();
Now that I am a bit further down the path, I am getting a new error and have dented in another portion of my head on it. I can send the request and get back the request token. I then work through the web authentication portion, fill in my Flickr username/pass, approve allowing this app to do what it needs to and then return to the WinRT app. At this point I try to pull in some pictures requiring authentication and get error code 98 invalid token and can't get to anything. I have tried to go out to and use either of the tokens I got and same error code 98. Listed below are the responses I get showing that I am getting a return. I would think that meant I did my part. What am I doing wrong now?

request token response = "oauth_callback_confirmed=true&oauth_token=72157635182641678-0a00ff02636b2a03&oauth_token_secret=5dd025a9079e43fb"
auth token response = "fullname=Steve%20Roe&oauth_token=72157635165989220-d1f8ba70404bf8fc&oauth_token_secret=5bc85b9e0092fe51&user_nsid=60803345%40N07&username=SteveRoePhotography"

Aug 22, 2013 at 5:00 AM
After trying out something from a different thread in this project, I stumbled on a solution. After getting the tokens as I do above, I call another function and get the authenticated instance. When I call it this way, it seems to work. Not sure why it wasn't working in my code directly. I will keep working on that one.
Flickr flickr = GetAuthInstance();
PhotoCollection photos = flickr.PhotosGetContactsPhotos();
this.DataContext = photos;

private FlickrNet.Flickr GetAuthInstance(string authToken, string authTokenSecret)
     var f = new FlickrNet.Flickr(ConsumerKey, ConsumerSecret)
          OAuthAccessToken = authToken,
          OAuthAccessTokenSecret = authTokenSecret
     return f;
Sep 16, 2013 at 5:48 AM
I've uploaded the windows 8 source code, and a sample windows 8 app.