private string getAuthToken() { AdmAccessToken admToken; string headerValue; //Get Client Id and Client Secret from https://datamarket.azure.com/developer/applications/ //Refer obtaining AccessToken (http://msdn.microsoft.com/en-us/library/hh454950.aspx) try { AdmAuthentication admAuth = new AdmAuthentication(cid, cst); admToken = admAuth.GetAccessToken(); TimeSpan span = new TimeSpan(0, 0, int.Parse(admToken.expires_in)); //set a timespan for the time that the token expires tokenExpiresAt = DateTime.Now.Add(span); headerValue = "Bearer " + admToken.access_token; } catch (WebException) { throw new Exception(MtEnhancedTradosPlugin.PluginResources.MsApiBadCredentialsMessage);// + prompt); } return(headerValue); }
private string getAuthToken() { AdmAccessToken admToken; string headerValue; //Get Client Id and Client Secret from https://datamarket.azure.com/developer/applications/ //Refer obtaining AccessToken (http://msdn.microsoft.com/en-us/library/hh454950.aspx) try { AdmAuthentication admAuth = new AdmAuthentication(cid, cst); admToken = admAuth.GetAccessToken(); TimeSpan span = new TimeSpan(0, 0, int.Parse(admToken.expires_in)); //set a timespan for the time that the token expires tokenExpiresAt = DateTime.Now.Add(span); headerValue = "Bearer " + admToken.access_token; } catch (WebException) { throw new Exception(MtEnhancedTradosPlugin.PluginResources.MsApiBadCredentialsMessage);// + prompt); } return headerValue; }