Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Azure MS AD Oauth2重定向后会话数据丢失_Azure_Oauth 2.0 - Fatal编程技术网

Azure MS AD Oauth2重定向后会话数据丢失

Azure MS AD Oauth2重定向后会话数据丢失,azure,oauth-2.0,Azure,Oauth 2.0,今天MS AD Oauth2重定向回后,我丢失了原始会话数据。在重定向到***************/oauth2/v2.0/authorize之后,它现在是一个全新的会话。但是,它在几天前工作,在一些windows10自动更新(并从凭据管理器重新键入一些tfs密码)后失败。但是,如果我使用GitHub授权服务器,同样的代码工作并保留我的会话数据:session[“state”]。我缺少什么?非常感谢您的帮助!我正在使用以下方式进行手动重定向: private void SignUpO

今天MS AD Oauth2重定向回后,我丢失了原始会话数据。在重定向到***************/oauth2/v2.0/authorize之后,它现在是一个全新的会话。但是,它在几天前工作,在一些windows10自动更新(并从凭据管理器重新键入一些tfs密码)后失败。但是,如果我使用GitHub授权服务器,同样的代码工作并保留我的会话数据:session[“state”]。我缺少什么?非常感谢您的帮助!我正在使用以下方式进行手动重定向:

    private void SignUpOAuth()
    {
        var state = Guid.NewGuid().ToString();
        var nonce = Guid.NewGuid().ToString();
        var clientId = "*************";
        var scope = "openid";
        var serviceUrl = ConfigurationManager.AppSettings.Get("OAuthServiceUrl");
        var redirectUrl = ConfigurationManager.AppSettings.Get("OAuthRedirectUrl");

        var paramtersPart = string.Format("response_type={0}&client_id={1}&scope={2}&redirect_uri={3}&aud{4}&state={5}&nonce={6}&response_mode=form_post",
            "id_token+code",
            HttpUtility.UrlEncode(clientId),
            HttpUtility.UrlEncode(scope),
            HttpUtility.UrlEncode(redirectUrl),
            HttpUtility.UrlEncode(serviceUrl),
            state,
            nonce);

        _context.Session.Add("state", state);
        _context.Session.Add("nonce", nonce);

        _context.Response.Redirect($"{ serviceUrl}?{paramtersPart}", false);
    }

更正:但是,如果我使用GitHub授权服务器,相同的代码会工作并保留我的会话数据:会话[“状态”]。我注意到MS AD授权服务器在返回“代码”时会点击Global.asax.cs的session_Start,而GitHub授权服务器则不会。可能与此相关:?