FlickrNet.Flickr.AuthGetFrob C# (CSharp) Méthode

AuthGetFrob() public méthode

Retrieve a temporary FROB from the Flickr service, to be used in redirecting the user to the Flickr web site for authentication. Only required for desktop authentication.
Pass the FROB to the AuthCalcUrl method to calculate the url.
public AuthGetFrob ( ) : string
Résultat string
        public string AuthGetFrob()
        {
            Hashtable parameters = new Hashtable();
            parameters.Add("method", "flickr.auth.getFrob");

            FlickrNet.Response response = GetResponseNoCache(parameters);
            if( response.Status == ResponseStatus.OK )
            {
                return response.AllElements[0].InnerText;
            }
            else
            {
                throw new FlickrException(response.Error);
            }
        }

Usage Example

Exemple #1
0
        public void Login()
        {
            // Create Flickr instance
            m_flickr = new Flickr(API_KEY, SECRET);

            m_frob = m_flickr.AuthGetFrob();

            string flickrUrl = m_flickr.AuthCalcUrl(m_frob, AuthLevel.Write);

            // The following line will load the URL in the users default browser.
            System.Diagnostics.Process.Start(flickrUrl);

            bool bIsAuthorized = false;
            m_auth = new Auth();

            // do nothing until flickr authorizes.
            while (!bIsAuthorized)
            {
                try
                {
                    m_auth = m_flickr.AuthGetToken(m_frob);
                    m_flickr.AuthToken = m_auth.Token;
                }
                catch (FlickrException ex)
                {
                    ;
                }

                if (m_flickr.IsAuthenticated)
                {
                    bIsAuthorized = true;
                }
            }
        }
All Usage Examples Of FlickrNet.Flickr::AuthGetFrob
Flickr