Inheritance: IFlickrParsable
コード例 #1
0
ファイル: FlickrHome.xaml.cs プロジェクト: liquidboy/X
        private async void CheckAlreadyExists() {
            var data = StorageService.Instance.Storage.RetrieveList<PassportDataModel>();
            if (data != null && data.Count > 0) {
                var dm = data[0];

                var apis = StorageService.Instance.Storage.RetrieveList<APIKeyDataModel>();
                if (apis != null && apis.Count > 0) apiKey = apis.Where(x => x.Id == dm.APIKeyFKID).FirstOrDefault();
                
                RequestToken = new OAuthRequestToken() { Token = dm.Token, TokenSecret = dm.TokenSecret };
                AccessToken = new OAuthAccessToken() {
                    Username = dm.UserName,
                    FullName = dm.FullName,
                    ScreenName = dm.ScreenName,
                    Token = dm.Token,
                    TokenSecret = dm.TokenSecret,
                    UserId = dm.UserId,
                };
                IsLoggedIn = true;

                _flickr.OAuthAccessToken = AccessToken.Token;
                _flickr.OAuthAccessTokenSecret = AccessToken.TokenSecret;

                _flickr.ApiKey = apiKey.APIKey;
                _flickr.ApiSecret = apiKey.APISecret;
                
                var p = await _flickr.PeopleGetInfoAsync(AccessToken.UserId);
                if(!p.HasError) LoggedInUser = p.Result;

                var favs = await _flickr.FavoritesGetListAsync(AccessToken.UserId);
                if (!favs.HasError) Favourites = favs.Result;

            }
        }
コード例 #2
0
        /// <summary>
        /// Parses a URL parameter encoded string and returns a new <see cref="OAuthAccessToken"/>
        /// </summary>
        /// <param name="response">A URL parameter encoded string, e.g. "oauth_token=ABC&amp;oauth_token_secret=DEF&amp;user_id=1234567@N00".</param>
        /// <returns></returns>
        internal static OAuthAccessToken ParseResponse(string response)
        {
            Dictionary <string, string> parts = UtilityMethods.StringToDictionary(response);

            OAuthAccessToken token = new OAuthAccessToken();

            if (parts.ContainsKey("oauth_token"))
            {
                token.Token = parts["oauth_token"];
            }
            if (parts.ContainsKey("oauth_token_secret"))
            {
                token.TokenSecret = parts["oauth_token_secret"];
            }
            if (parts.ContainsKey("user_nsid"))
            {
                token.UserId = parts["user_nsid"];
            }
            if (parts.ContainsKey("fullname"))
            {
                token.FullName = parts["fullname"];
            }
            if (parts.ContainsKey("username"))
            {
                token.Username = parts["username"];
            }

            return(token);
        }
コード例 #3
0
        /// <summary>
        /// Parses a URL parameter encoded string and returns a new <see cref="OAuthAccessToken"/>
        /// </summary>
        /// <param name="response">A URL parameter encoded string, e.g. "oauth_token=ABC&amp;oauth_token_secret=DEF&amp;user_id=1234567@N00".</param>
        /// <returns></returns>
        internal static OAuthAccessToken ParseResponse(string response)
        {
            if (response.Contains("//:"))
            {
                response = response.Substring(response.IndexOf("?", StringComparison.Ordinal));
            }
            Dictionary <string, string> parts = UtilityMethods.StringToDictionary(response);

            var token = new OAuthAccessToken();

            if (parts.ContainsKey("oauth_token"))
            {
                token.Token = parts["oauth_token"];
            }
            if (parts.ContainsKey("oauth_token_secret"))
            {
                token.TokenSecret = parts["oauth_token_secret"];
            }
            if (parts.ContainsKey("user_nsid"))
            {
                token.UserId = parts["user_nsid"];
            }
            if (parts.ContainsKey("fullname"))
            {
                token.FullName = parts["fullname"];
            }
            if (parts.ContainsKey("username"))
            {
                token.Username = parts["username"];
            }

            return(token);
        }
コード例 #4
0
        public void ViewInit()
        {
            if (IsFlickrLoginDetailsCached())
            {
                _at = new OAuthAccessToken();
                var found = Services.AppDatabase.Current.AppStates.Where(x => x.Name == "at.FullName").FirstOrDefault();
                _at.FullName = found.Value;
                found = Services.AppDatabase.Current.AppStates.Where(x => x.Name == "at.ScreenName").FirstOrDefault();
                _at.ScreenName = found.Value;
                found = Services.AppDatabase.Current.AppStates.Where(x => x.Name == "at.UserId").FirstOrDefault();
                _at.UserId = found.Value;
                found = Services.AppDatabase.Current.AppStates.Where(x => x.Name == "at.Username").FirstOrDefault();
                _at.Username = found.Value;
                found = Services.AppDatabase.Current.AppStates.Where(x => x.Name == "at.Token").FirstOrDefault();
                _at.Token = found.Value;
                found = Services.AppDatabase.Current.AppStates.Where(x => x.Name == "at.TokenSecret").FirstOrDefault();
                _at.TokenSecret = found.Value;
                found = Services.AppDatabase.Current.AppStates.Where(x => x.Name == "fp.BuddyIconUrl").FirstOrDefault();
                BuddyIconUrl = found != null ? found.Value : string.Empty;

                _flickr.OAuthAccessToken = _at.Token;
                _flickr.OAuthAccessTokenSecret = _at.TokenSecret;

            }
        }
コード例 #5
0
 public static void setCookie(OAuthAccessToken value)
 {
     HttpCookie cookie = new HttpCookie("OAuthToken");
     cookie.Expires = DateTime.UtcNow.AddHours(1);
     cookie.Values["FullName"] = value.FullName;
     cookie.Values["Token"] = value.Token;
     cookie.Values["TokenSecret"] = value.TokenSecret;
     cookie.Values["UserId"] = value.UserId;
     cookie.Values["Username"] = value.Username;
     HttpContext.Current.Response.AppendCookie(cookie);
 }
コード例 #6
0
ファイル: OAuthAccessToken.cs プロジェクト: rmck/FlickrNet
 internal static OAuthAccessToken ParseResponse(string response)
 {
     Dictionary<string, string> dictionary = UtilityMethods.StringToDictionary(response);
       OAuthAccessToken oauthAccessToken = new OAuthAccessToken();
       if (dictionary.ContainsKey("oauth_token"))
     oauthAccessToken.Token = dictionary["oauth_token"];
       if (dictionary.ContainsKey("oauth_token_secret"))
     oauthAccessToken.TokenSecret = dictionary["oauth_token_secret"];
       if (dictionary.ContainsKey("user_nsid"))
     oauthAccessToken.UserId = dictionary["user_nsid"];
       if (dictionary.ContainsKey("fullname"))
     oauthAccessToken.FullName = dictionary["fullname"];
       if (dictionary.ContainsKey("username"))
     oauthAccessToken.Username = dictionary["username"];
       return oauthAccessToken;
 }
コード例 #7
0
ファイル: Flickr_Auth.cs プロジェクト: vnisor/FlickrNet
        /// <summary>
        /// Takes the currently (old) authentication Flickr instance and turns it OAuth authenticated instance.
        /// </summary>
        /// <remarks>
        /// Calling this method will also clear <see cref="Flickr.AuthToken"/>
        /// and set <see cref="Flickr.OAuthAccessToken"/> and <see cref="Flickr.OAuthAccessTokenSecret"/>.
        /// </remarks>
        /// <returns>A new <see cref="OAuthAccessToken"/> instance.</returns>
        public OAuthAccessToken AuthOAuthGetAccessToken()
        {
            CheckRequiresAuthentication();

            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("method", "flickr.auth.oauth.getAccessToken");

            OAuthAccessToken token = GetResponseNoCache <OAuthAccessToken>(parameters);

            OAuthAccessToken       = token.Token;
            OAuthAccessTokenSecret = token.TokenSecret;

            AuthToken = null;

            return(token);
        }
コード例 #8
0
        public static void BuildOAuthToken()
        {
            Flickr f = GetInstance();
            OAuthRequestToken requestToken = f.OAuthGetRequestToken("oob");

            string url = f.OAuthCalculateAuthorizationUrl(requestToken.Token, AuthLevel.Delete);

            Process.Start(url);
            // TODO: This is not interactive at the moment, must be handled via debug session
            // Put a debug breakpoint on the process.start, run tests in debug, and modify code in-place with browser token during execution
            const string verificationNumber = "974-138-162";

            OAuthAccessToken accessToken = f.OAuthGetAccessToken(requestToken, verificationNumber);
            OAuthToken = accessToken;

            //Step2GroupBox.Enabled = true;
        }
コード例 #9
0
ファイル: OAuthAccessToken.cs プロジェクト: liquidboy/X
        /// <summary>
        /// Parses a URL parameter encoded string and returns a new <see cref="OAuthAccessToken"/>
        /// </summary>
        /// <param name="response">A URL parameter encoded string, e.g. "oauth_token=ABC&amp;oauth_token_secret=DEF&amp;user_id=1234567@N00".</param>
        /// <returns></returns>
        public static OAuthAccessToken ParseResponse(string response)
        {
            Dictionary<string, string> parts = UtilityMethods.StringToDictionary(response);

            OAuthAccessToken token = new OAuthAccessToken();
            if( parts.ContainsKey("oauth_token") )
                token.Token = parts["oauth_token"];
            if (parts.ContainsKey("oauth_token_secret"))
                token.TokenSecret = parts["oauth_token_secret"];
            if (parts.ContainsKey("user_nsid"))
                token.UserId = parts["user_nsid"];
            if (parts.ContainsKey("fullname"))
                token.FullName = parts["fullname"];
            if (parts.ContainsKey("username"))
                token.Username = parts["username"];
            if (parts.ContainsKey("screen_name"))
                token.ScreenName = parts["screen_name"];

            return token;
        }
コード例 #10
0
        /// <summary>
        /// Parses a URL parameter encoded string and returns a new <see cref="OAuthAccessToken"/>
        /// </summary>
        /// <param name="response">A URL parameter encoded string, e.g. "oauth_token=ABC&amp;oauth_token_secret=DEF&amp;user_id=1234567@N00".</param>
        /// <returns></returns>
        internal static OAuthAccessToken ParseResponse(string response)
        {
            if (response.Contains("//:"))
            {
                response = response.Substring(response.IndexOf("?", StringComparison.Ordinal));
            }
            Dictionary<string, string> parts = UtilityMethods.StringToDictionary(response);

            var token = new OAuthAccessToken();
            if (parts.ContainsKey("oauth_token"))
                token.Token = parts["oauth_token"];
            if (parts.ContainsKey("oauth_token_secret"))
                token.TokenSecret = parts["oauth_token_secret"];
            if (parts.ContainsKey("user_nsid"))
                token.UserId = parts["user_nsid"];
            if (parts.ContainsKey("fullname"))
                token.FullName = parts["fullname"];
            if (parts.ContainsKey("username"))
                token.Username = parts["username"];

            return token;
        }
コード例 #11
0
        private async void PageRootLoaded(object sender, RoutedEventArgs e)
        {
            if (AccessToken != null) return;

            var f = new Flickr("dbc316af64fb77dae9140de64262da0a", "0781969a058a2745");
            var requestToken = await GetRequestToken();
            string output;
            var flickrUri = new Uri(f.OAuthCalculateAuthorizationUrl(requestToken.Token, AuthLevel.Delete));
            var webAuthenticationResult = await WebAuthenticationBroker.AuthenticateAsync(
                                                    WebAuthenticationOptions.None,
                                                    flickrUri);

            if (webAuthenticationResult.ResponseStatus == WebAuthenticationStatus.Success)
            {
                output = webAuthenticationResult.ResponseData;
                AccessToken = await f.OAuthAccessTokenAsync(requestToken.Token, requestToken.TokenSecret, output);

                LoadDataSource(AccessToken);
            }
            else if (webAuthenticationResult.ResponseStatus == WebAuthenticationStatus.ErrorHttp)
            {
                output = "HTTP Error returned by AuthenticateAsync() : " + webAuthenticationResult.ResponseErrorDetail.ToString();
            }
            else if (webAuthenticationResult.ResponseStatus == WebAuthenticationStatus.UserCancel)
            {
                output = "Authentication process was cancelled by the user";
            } 
        }
コード例 #12
0
        private async void LoadDataSource(OAuthAccessToken accessToken)
        {
            var f = new Flickr("dbc316af64fb77dae9140de64262da0a", "0781969a058a2745")
                        {
                            OAuthAccessToken = accessToken.Token,
                            OAuthAccessTokenSecret = accessToken.TokenSecret
                        };

            var groups = DefaultViewModel["Groups"] as ObservableCollection<SampleDataGroup>;
            groups.Clear();
            var photostreamGroup = new SampleDataGroup("A", "Your Photos", "Photostream", "", "");
            groups.Add(photostreamGroup);

            var contactsGroup = new SampleDataGroup("A", "Your Contact", "Latest Updates", "", "");
            groups.Add(contactsGroup);

            var favouritesGroup = new SampleDataGroup("A", "Your Favourites", "Favourite Photos", "", "");
            groups.Add(favouritesGroup);

            var photos = await f.PeopleGetPhotosAsync(accessToken.UserId, SafetyLevel.None, null, null, null, null,
                                                      ContentTypeSearch.None, PrivacyFilter.None,
                                                      PhotoSearchExtras.Description | PhotoSearchExtras.LargeUrl, 1,
                                                      30);
            foreach (
                var photo in
                    photos.Select(
                        p => new SampleDataItem(p.PhotoId, p.Title, "", p.LargeUrl, p.Description, p.Description, photostreamGroup))
                )
            {
                photostreamGroup.Items.Add(photo);
            }

            photos =
                await f.PhotosGetContactsPhotosAsync(extras: PhotoSearchExtras.Description | PhotoSearchExtras.LargeUrl | PhotoSearchExtras.OwnerName);
            foreach (
                var photo in
                    photos.Select(
                        p => new SampleDataItem(p.PhotoId, p.Title, p.OwnerName, p.LargeUrl, p.Description, p.Description, contactsGroup))
                )
            {
                contactsGroup.Items.Add(photo);
            }

            photos = await f.FavoritesGetListAsync(extras: PhotoSearchExtras.Description | PhotoSearchExtras.LargeUrl | PhotoSearchExtras.OwnerName);
            foreach (
                var photo in
                    photos.Select(
                        p => new SampleDataItem(p.PhotoId, p.Title, p.OwnerName, p.LargeUrl, p.Description, p.Description, favouritesGroup))
                )
            {
                favouritesGroup.Items.Add(photo);
            }
        }
コード例 #13
0
        private void AuthorizationGiven()
        {
            ////ONCE USER GIVES AUTHORIZATION IN FLICKRWEB GET THAT VERIFICATION FOR THE APP
            //flickr.AuthGetTokenAsync(frob, new Action<FlickrNet.FlickrResult<Auth>>(auth =>
            //{
            //    if (!auth.HasError)
            //    {
            //        flickr_Auth = auth.Result;

            //        Dispatcher.Invoke(Windows.UI.Core.CoreDispatcherPriority.High, new Windows.UI.Core.InvokedHandler((r, a) =>
            //        {
            //            butAuthorizationGiven.IsEnabled = false;
            //        }), this, null);


            //        GetLoggedInUserDetails(flickr_Auth.User);
            //    }
            //}));


            //3. COPY THE VERIFICATION CODE FROM THE FLICKR PAGE AND USE IT TO GET AN "ACCESS" TOKEN
            string OAuthVerificationCode = ""; //txtOAuthVerificationCode.Text
            if (OAuthVerificationCode.Length == 0) return;
            _flickr.OAuthGetAccessTokenAsync(rt, OAuthVerificationCode, new Action<FlickrResult<OAuthAccessToken>>(rat =>
            {

                if (!rat.HasError)
                {
                    at = rat.Result;

                    //USE YOUR ACCESS TO START MAKING API CALLS
                    GetLoggedInUserDetails(at.UserId);
                }
            }));

        }
コード例 #14
0
ファイル: FlickrHome.xaml.cs プロジェクト: liquidboy/X
        private async void ctlApiEditor_SaveComplete(object sender, EventArgs e)
        {
            apiKey = ctlApiEditor.APIKey;

            try
            {
                _flickr.ApiKey = apiKey.APIKey;
                _flickr.ApiSecret = apiKey.APISecret;
                

                // Acquiring a request token
                TimeSpan SinceEpoch = DateTime.UtcNow - new DateTime(1970, 1, 1);
                Random Rand = new Random();
                String FlickrUrl = "https://secure.flickr.com/services/oauth/request_token";
                Int32 Nonce = Rand.Next(1000000000);

                // Compute base signature string and sign it.
                // This is a common operation that is required for all requests even after the token is obtained.
                // Parameters need to be sorted in alphabetical order
                // Keys and values should be URL Encoded.
                String SigBaseStringParams = "oauth_callback=" + Uri.EscapeDataString(apiKey.APICallbackUrl);
                SigBaseStringParams += "&" + "oauth_consumer_key=" + apiKey.APIKey;
                SigBaseStringParams += "&" + "oauth_nonce=" + Nonce.ToString();
                SigBaseStringParams += "&" + "oauth_signature_method=HMAC-SHA1";
                SigBaseStringParams += "&" + "oauth_timestamp=" + Math.Round(SinceEpoch.TotalSeconds);
                SigBaseStringParams += "&" + "oauth_version=1.0";
                String SigBaseString = "GET&";
                SigBaseString += Uri.EscapeDataString(FlickrUrl) + "&" + Uri.EscapeDataString(SigBaseStringParams);

                IBuffer KeyMaterial = CryptographicBuffer.ConvertStringToBinary(apiKey.APISecret + "&", BinaryStringEncoding.Utf8);
                MacAlgorithmProvider HmacSha1Provider = MacAlgorithmProvider.OpenAlgorithm("HMAC_SHA1");
                CryptographicKey MacKey = HmacSha1Provider.CreateKey(KeyMaterial);
                IBuffer DataToBeSigned = CryptographicBuffer.ConvertStringToBinary(SigBaseString, BinaryStringEncoding.Utf8);
                IBuffer SignatureBuffer = CryptographicEngine.Sign(MacKey, DataToBeSigned);
                String Signature = CryptographicBuffer.EncodeToBase64String(SignatureBuffer);

                FlickrUrl += "?" + SigBaseStringParams + "&oauth_signature=" + Uri.EscapeDataString(Signature);
                string GetResponse = await SendDataAsync(FlickrUrl);
                //rootPage.NotifyUser("Received Data: " + GetResponse, NotifyType.StatusMessage);


                if (GetResponse != null)
                {
                    String oauth_token = null;
                    String oauth_token_secret = null;
                    String[] keyValPairs = GetResponse.Split('&');

                    for (int i = 0; i < keyValPairs.Length; i++)
                    {
                        String[] splits = keyValPairs[i].Split('=');
                        switch (splits[0])
                        {
                            case "oauth_token":
                                oauth_token = splits[1];
                                break;
                            case "oauth_token_secret":
                                oauth_token_secret = splits[1];
                                break;
                        }
                    }

                    RequestToken = new OAuthRequestToken() { Token = oauth_token, TokenSecret = oauth_token_secret };

                    if (oauth_token != null)
                    {
                        FlickrUrl = "https://secure.flickr.com/services/oauth/authorize?oauth_token=" + oauth_token + "&perms=read";
                        System.Uri StartUri = new Uri(FlickrUrl);
                        System.Uri EndUri = new Uri(apiKey.APICallbackUrl.Contains("http") ? apiKey.APICallbackUrl : $"http://{apiKey.APICallbackUrl}");

                        //rootPage.NotifyUser("Navigating to: " + FlickrUrl, NotifyType.StatusMessage);
                        WebAuthenticationResult WebAuthenticationResult = await WebAuthenticationBroker.AuthenticateAsync(
                                                                WebAuthenticationOptions.None,
                                                                StartUri,
                                                                EndUri);
                        if (WebAuthenticationResult.ResponseStatus == WebAuthenticationStatus.Success)
                        {
                            OutputToken(WebAuthenticationResult.ResponseData.ToString());
                            String[] partsa = WebAuthenticationResult.ResponseData.ToString().Split('?');
                            String[] partsb = partsa[1].Split('&');

                            var xoauth_token = "";
                            var xoauth_verifier = "";

                            for (int i = 0; i < partsb.Length; i++)
                            {
                                String[] partsc = partsb[i].Split('=');
                                switch (partsc[0])
                                {
                                    case "oauth_token":
                                        xoauth_token = partsc[1];
                                        break;
                                    case "oauth_verifier":
                                        xoauth_verifier = partsc[1];
                                        break;
                                }
                            }


                            var rat = await _flickr.OAuthGetAccessTokenAsync(RequestToken, xoauth_verifier);
                            if (!rat.HasError)
                            {
                                AccessToken = rat.Result;

                                var dm = new PassportDataModel();
                                dm.Token = AccessToken.Token;
                                dm.TokenSecret = AccessToken.TokenSecret;
                                dm.Verifier = xoauth_verifier;
                                dm.PassType = "Flickr";

                                dm.UserId = AccessToken.UserId;
                                dm.UserName = AccessToken.Username;
                                dm.FullName = AccessToken.FullName;
                                dm.ScreenName = AccessToken.ScreenName;

                                dm.APIKeyFKID = apiKey.Id;


                                StorageService.Instance.Storage.Insert(dm);
                            }

                        }
                        else if (WebAuthenticationResult.ResponseStatus == WebAuthenticationStatus.ErrorHttp)
                        {
                            OutputToken("HTTP Error returned by AuthenticateAsync() : " + WebAuthenticationResult.ResponseErrorDetail.ToString());
                        }
                        else
                        {
                            OutputToken("Error returned by AuthenticateAsync() : " + WebAuthenticationResult.ResponseStatus.ToString());
                        }
                    }
                }
            }
            catch //(Exception Error)
            {
                //rootPage.NotifyUser(Error.Message, NotifyType.ErrorMessage);
            }
        }
コード例 #15
0
        private void WebBrowser1_Navigating(object sender, NavigatingEventArgs e)
        {
            // if we are not navigating to the callback url then authentication is not complete.
            if (!e.Uri.AbsoluteUri.StartsWith(callbackUrl)) return;

            // Get "oauth_verifier" part of the query string.
            var oauthVerifier = e.Uri.Query.Split('&')
                .Where(s => s.Split('=')[0] == "oauth_verifier")
                .Select(s => s.Split('=')[1])
                .FirstOrDefault();

            if (String.IsNullOrEmpty(oauthVerifier))
            {
                MessageBox.Show("Unable to find Verifier code in uri: " + e.Uri.AbsoluteUri);
                return;
            }

            // Found verifier, so cancel navigation
            e.Cancel = true;

            // Obtain the access token from Flickr
            Flickr f = FlickrManager.GetInstance();

            f.OAuthGetAccessTokenAsync(requestToken, oauthVerifier, r =>
            {
                // Check if an error was returned
                if (r.Error != null)
                {
                    Dispatcher.BeginInvoke(() =>
                    {
                        MessageBox.Show("An error occurred getting the access token: " + r.Error.Message);
                    });
                    return;
                }

                accessToken = r.Result;

                // Save the oauth token for later use
                FlickrManager.OAuthToken = accessToken.Token;
                FlickrManager.OAuthTokenSecret = accessToken.TokenSecret;
                FlickrManager.OAuthUserID = accessToken.UserId;

                Dispatcher.BeginInvoke(() =>
                {
                    //MessageBox.Show("Authentication completed for user " + accessToken.FullName + ", with token " + accessToken.Token);
                    NavigationService.Navigate(new Uri("/" + "MainPage" + ".xaml", UriKind.Relative));
                    return;
                });

            });

        }
コード例 #16
0
ファイル: SplashVM.cs プロジェクト: liquidboy/X
        private async void PopulatePassportData()
        {
            if (apiKey == null) { IsLoginVisible = Visibility.Visible; return; }

            var data = StorageService.Instance.Storage.RetrieveList<PassportDataModel>();
            if (data != null && data.Count > 0)
            {
                IsLoginVisible = Visibility.Visible;
                IsTabsVisible = Visibility.Collapsed;

                var dm = data.Where(x => x.PassType == GroupingType).FirstOrDefault();
                if (dm != null) {
                    IsLoginVisible = Visibility.Collapsed;
                    IsTabsVisible = Visibility.Visible;
                    
                    RequestToken = new OAuthRequestToken() { Token = dm.Token, TokenSecret = dm.TokenSecret };
                    AccessToken = new OAuthAccessToken()
                    {
                        Username = dm.UserName,
                        FullName = dm.FullName,
                        ScreenName = dm.ScreenName,
                        Token = dm.Token,
                        TokenSecret = dm.TokenSecret,
                        UserId = dm.UserId,
                    };
                    //IsLoggedIn = true;

                    _flickr.OAuthAccessToken = AccessToken.Token;
                    _flickr.OAuthAccessTokenSecret = AccessToken.TokenSecret;

                    _flickr.ApiKey = apiKey.APIKey;
                    _flickr.ApiSecret = apiKey.APISecret;

                    var p = await _flickr.PeopleGetInfoAsync(AccessToken.UserId);
                    if (!p.HasError) LoggedInUser = p.Result;

                    var favs = await _flickr.FavoritesGetListAsync(AccessToken.UserId);
                    if (!favs.HasError) {
                        var temp = new PhotoCollection();
                        foreach (var fav in favs.Result)
                        {
                            //fav.MachineTags = "https://c1.staticflickr.com/1/523/buddyicons/118877287@N03_l.jpg?1437204284#118877287@N03";
                            fav.MachineTags = $"https://c1.staticflickr.com/{fav.IconFarm}/{fav.IconServer}/buddyicons/{fav.UserId}.jpg?";
                            temp.Add(fav);
                        }
                        FavouritePhotos = temp;
                    }
                    
                }
            }
            else {
                //no passport so show login button
                IsLoginVisible = Visibility.Visible;
                IsTabsVisible = Visibility.Collapsed;
            }
        }