예제 #1
0
        public AuthenticationProvider(string id, string secret)
        {
            client_id = id;
            client_secret = secret;

            request = string.Format("grant_type=client_credentials&client_id={0}&client_secret={1}&scope=http://api.microsofttranslator.com",HttpUtility.UrlEncode(client_id), HttpUtility.UrlEncode(client_secret));
            token = HttpPost();
            token_timestamp = DateTime.Now;
        }
예제 #2
0
        public AccessToken GetAccessToken()
        {
            if (DateTime.Now > token_timestamp.AddMinutes(token_renewal_interval))
            {
                token = HttpPost();
                token_timestamp = DateTime.Now;
            }

            return token;
        }