From 0370ee31705c78d2f52b0ec7b130ec4fe50be580 Mon Sep 17 00:00:00 2001 From: Kumar Ashwin Hubert Date: Tue, 9 Jan 2018 00:00:56 +0530 Subject: [PATCH] Sign-out message instead of throwing error response always --- CSharp/BotAuth/Controllers/CallbackController.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/CSharp/BotAuth/Controllers/CallbackController.cs b/CSharp/BotAuth/Controllers/CallbackController.cs index ede867c..cb35a8d 100644 --- a/CSharp/BotAuth/Controllers/CallbackController.cs +++ b/CSharp/BotAuth/Controllers/CallbackController.cs @@ -28,7 +28,17 @@ public class CallbackController : ApiController [Route("Callback")] public async Task Callback() { - return Request.CreateErrorResponse(HttpStatusCode.BadRequest, new Exception()); + try + { + var resp = new HttpResponseMessage(HttpStatusCode.OK); + resp.Content = new StringContent($"You have been signed out. You can now close this window.", System.Text.Encoding.UTF8, @"text/html"); + return resp; + } + catch (Exception ex) + { + // Callback is called with no pending message as a result the login flow cannot be resumed. + return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex); + } } [HttpGet]