Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/clojure/3.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
Microsoft graph api 使用多个重定向url';s代表“A”;申请注册门户;应用程序_Microsoft Graph Api_Identityserver3 - Fatal编程技术网

Microsoft graph api 使用多个重定向url';s代表“A”;申请注册门户;应用程序

Microsoft graph api 使用多个重定向url';s代表“A”;申请注册门户;应用程序,microsoft-graph-api,identityserver3,Microsoft Graph Api,Identityserver3,如果我在“”中创建应用程序,则只有第一个重定向url有效 比如,;如果我先添加,这个url会工作。但如果我加上,它不会。 当我添加第一个和第二个时,只有localhost url起作用 使一切正常工作的唯一方法是在“应用程序注册门户”中创建两个独立的应用程序。一个用于开发环境,一个用于生产 对我来说,这就像是服务器端缓存问题。解决了它!我忘了尝试在github上找到的解决方案,它解决了我的问题 更新 my Startup.Auth.cs中的ConfigureAuth方法现在包含以下代码: a

如果我在“”中创建应用程序,则只有第一个重定向url有效

比如,;如果我先添加,这个url会工作。但如果我加上,它不会。 当我添加第一个和第二个时,只有localhost url起作用

使一切正常工作的唯一方法是在“应用程序注册门户”中创建两个独立的应用程序。一个用于开发环境,一个用于生产


对我来说,这就像是服务器端缓存问题。

解决了它!我忘了尝试在github上找到的解决方案,它解决了我的问题


更新

my Startup.Auth.cs中的ConfigureAuth方法现在包含以下代码:

app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);

app.UseCookieAuthentication(new CookieAuthenticationOptions());

app.UseOpenIdConnectAuthentication(
    new OpenIdConnectAuthenticationOptions
    {
        ClientId = clientId,
        Authority = Authority,

        Notifications = new OpenIdConnectAuthenticationNotifications()
        {
            // If there is a code in the OpenID Connect response, redeem it for an access token and refresh token, and store those away.
            AuthorizationCodeReceived = (context) =>
            {
                var code = context.Code;
                ClientCredential credential = new ClientCredential(clientId, appKey);
                string signedInUserID = context.AuthenticationTicket.Identity.FindFirst(ClaimTypes.NameIdentifier).Value;
                AuthenticationContext authContext = new AuthenticationContext(Authority, new ADALTokenCache(signedInUserID));
                AuthenticationResult result = authContext.AcquireTokenByAuthorizationCode(code, new Uri(redirectUri), credential, graphResourceId);

                return Task.FromResult(0);
            },

            RedirectToIdentityProvider = (context) =>
            {
                context.ProtocolMessage.RedirectUri = redirectUri;
                context.ProtocolMessage.PostLogoutRedirectUri = redirectUri;

                return Task.FromResult(0);
            }
        },
    }
);
注意:此代码用于ASP.NET MVC应用程序,该应用程序使用基于cookie的身份验证