AzureTranslate.Translation.GenerateAuthToken C# (CSharp) Method

GenerateAuthToken() private static method

private static GenerateAuthToken ( string client_id = null, string client_secret = null ) : string
client_id string
client_secret string
return string
        private static string GenerateAuthToken(string client_id = null, string client_secret = null) {

            AdmAccessToken admToken;
            string headerValue;

            // Checks if azure login info is overriden
            client_id = client_id == null ? azure_client_id : client_id;
            client_secret = client_secret == null ? azure_client_secret : client_secret;

            AdmAuthentication admAuth = new AdmAuthentication(client_id, client_secret);
            admToken = admAuth.GetAccessToken();
            DateTime tokenReceived = DateTime.Now;
            // Create a header with the access_token property of the returned token
            headerValue = "Bearer " + admToken.access_token;

            // Return header
            return headerValue;

        }