FlickrNet.Flickr.AuthCheckToken C# (CSharp) Method

AuthCheckToken() public method

Checks a authentication token with the flickr service to make sure it is still valid.
public AuthCheckToken ( string token ) : Auth
token string The authentication token to check.
return Auth
        public Auth AuthCheckToken(string token)
        {
            Hashtable parameters = new Hashtable();
            parameters.Add("method", "flickr.auth.checkToken");
            parameters.Add("auth_token", token);

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

Usage Example

	    protected Auth CheckAuthenticationToken(IAuthenticationSettings authenticationSettings)
		{
			if (string.IsNullOrEmpty(authenticationSettings.FlickrAuthToken))
			{
				throw new Exception("No Flickr AuthToken!");
			}

			Flickr.CacheTimeout = new TimeSpan(1, 0, 0, 0, 0);

			var flickrService = new Flickr(authenticationSettings.FlickrApiKey, authenticationSettings.FlickrApiSecret, authenticationSettings.FlickrAuthToken);
			var authenticationToken = flickrService.AuthCheckToken(authenticationSettings.FlickrAuthToken);

			return authenticationToken;
		}
All Usage Examples Of FlickrNet.Flickr::AuthCheckToken
Flickr