public async Task <IHttpActionResult> GetFeedbackDetails([FromUri] string key) { var isKeyMatch = object.Equals(key, CloudConfigurationManager.GetSetting("Key")); if (isKeyMatch) { // Get the token here to proactively trigger a refresh if the cached token is expired // This avoids a race condition in MicrosoftAppCredentials.GetTokenAsync that can lead it to return an expired token await this.botCredentials.GetTokenAsync(); var result = await _botRepository.FeedBackDetailsExport(DateTime.UtcNow.AddDays(-1 * Constants.FeedBackDelayDays)); return(this.Ok(result)); } else { return(this.Unauthorized()); } }