/// <summary>
        /// This method returns the account information of a dropbox account
        /// </summary>
        /// <param name="token"></param>
        /// <returns></returns>
        static public DropBoxAccountInfo GetAccountInformation(ICloudStorageAccessToken token)
        {
            // generate the dropbox service
            DropBoxStorageProviderService service = new DropBoxStorageProviderService();

            // generate a session
            IStorageProviderSession session = service.CreateSession(token, DropBoxConfiguration.GetStandardConfiguration());

            if (session == null)
            {
                return(null);
            }

            // receive acc info
            DropBoxAccountInfo accInfo = service.GetAccountInfo(session);

            // close the session
            service.CloseSession(session);

            // go ahead
            return(accInfo);
        }
        /// <summary>
        /// This method offers the mobile login api of dropbox for users who are migrating from version 0 of the
        /// dropbox API because version 1 supports token based logins only
        /// </summary>
        /// <param name="username"></param>
        /// <param name="password"></param>
        /// <param name="appkey"></param>
        /// <param name="appsecret"></param>
        /// <returns></returns>
        static public ICloudStorageAccessToken LoginWithMobileAPI(String username, String password, String appkey, String appsecret)
        {
            // get the configuration
            DropBoxConfiguration configuration = DropBoxConfiguration.GetStandardConfiguration();

            // build the consumer context
            var consumerContext = new OAuthConsumerContext(appkey, appsecret);

            // build up the oauth session
            var serviceContext = new OAuthServiceContext(configuration.RequestTokenUrl.ToString(),
                                                         configuration.AuthorizationTokenUrl.ToString(), configuration.AuthorizationCallBack.ToString(),
                                                         configuration.AccessTokenUrl.ToString());

            // get a request token from the provider
            OAuthService svc = new OAuthService();
            var          oAuthRequestToken = svc.GetRequestToken(serviceContext, consumerContext);

            if (oAuthRequestToken == null)
            {
                throw new SharpBoxException(SharpBoxErrorCodes.ErrorInvalidConsumerKeySecret);
            }
            DropBoxToken DropBoxRequestToken = new DropBoxToken(oAuthRequestToken, new DropBoxBaseTokenInformation()
            {
                ConsumerKey = appkey, ConsumerSecret = appsecret
            });

            // generate the dropbox service
            DropBoxStorageProviderService service = new DropBoxStorageProviderService();

            // build up a request Token Session
            var requestSession = new DropBoxStorageProviderSession(DropBoxRequestToken, configuration, consumerContext, service);

            // build up the parameters
            var param = new Dictionary <String, String>
            {
                { "email", username },
                { "password", password }
            };

            // call the mobile login api
            String result = "";

            try
            {
                int code;
                result = DropBoxRequestParser.RequestResourceByUrl(DropBoxMobileLogin, param, service, requestSession, out code);
                if (result.Length == 0)
                {
                    throw new UnauthorizedAccessException();
                }
            }

#if MONOTOUCH || WINDOWS_PHONE || MONODROID
            catch (Exception ex)
            {
                if (ex is UnauthorizedAccessException)
                {
                    throw ex;
                }
                else
                {
                    throw new SharpBoxException(SharpBoxErrorCodes.ErrorCouldNotContactStorageService, ex);
                }
            }
#else
            catch (System.Web.HttpException netex)
            {
                throw new SharpBoxException(SharpBoxErrorCodes.ErrorCouldNotContactStorageService, netex);
            }
#endif

            // exchange a request token for an access token
            var accessToken = new DropBoxToken(result);

            // adjust the token
            if (accessToken.BaseTokenInformation == null)
            {
                accessToken.BaseTokenInformation                = new DropBoxBaseTokenInformation();
                accessToken.BaseTokenInformation.ConsumerKey    = appkey;
                accessToken.BaseTokenInformation.ConsumerSecret = appsecret;
            }


            // go ahead
            return(accessToken);
        }