private ActionResult ShowSignin(bool usingRSC) { // missing, bad, or expired token QandAModelWrapper wrapper = new QandAModelWrapper() { useRSC = usingRSC, showLogin = true, model = null }; return(View("First", wrapper)); }
public async Task <ActionResult> First( [FromUri(Name = "tenantId")] string tenantId, [FromUri(Name = "teamId")] string teamId, [FromUri(Name = "channelId")] string channelId, [FromUri(Name = "skipRefresh")] Nullable <bool> skipRefresh, [FromUri(Name = "useRSC")] Nullable <bool> useRSC ) { bool usingRSC = (useRSC != false); try { // Do our auth check first GraphServiceClient graph = await Authorization.GetGraphClient(teamId, Request.Cookies, Response.Cookies, usingRSC); QandAModel model = GetModel(tenantId, teamId, channelId, ""); QandAModelWrapper wrapper = new QandAModelWrapper() { useRSC = usingRSC, showLogin = false, model = model }; if (skipRefresh != true) { await RefreshQandA(model, graph); GraphServiceClient graphForWebhooks = await Authorization.GetGraphClientForCreatingWebhooks(teamId, Request.Cookies, Response.Cookies, usingRSC); await CreateSubscription(channelId, model, graphForWebhooks); } ViewBag.MyModel = model; return(View("First", wrapper)); } catch (Exception e) when(e.Message.Contains("Unauthorized") || e.Message.Contains("Access token has expired.")) { return(ShowSignin(usingRSC)); } }