小编use*_*658的帖子

成功登录后身份服务器不会重定向

我正在尝试使用 MVC 客户端设置 IdentityServer4。

一切正常,直到我想添加 ASP 标识。当我添加代码以使用 SQL 服务器和身份时,在成功登录后身份服务器不会将我重定向回我的客户端,而只是“刷新”页面。

IdentityServer 应用程序启动:

 public class Startup
    {
        public IWebHostEnvironment Environment { get; }

        public IConfiguration Configuration { get; }

        public Startup(IWebHostEnvironment environment, IConfiguration configuration)
        {
            Environment = environment;
            Configuration = configuration;
        }

        public void ConfigureServices(IServiceCollection services)
        {
            // uncomment, if you want to add an MVC-based UI
            services.AddControllersWithViews();

            services.AddDbContext<NebankaDbContext>(options =>
                options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));

            services.AddIdentity<NebankaUser, IdentityRole>()
               .AddEntityFrameworkStores<NebankaDbContext>()
               .AddDefaultTokenProviders();

            services.AddAuthentication()
                .AddGoogle("Google", options =>
                {
                    options.SignInScheme = IdentityServerConstants.ExternalCookieAuthenticationScheme;

                    options.ClientId = "695872592852-tc9u84trcicjuhrrei1ikdmriarl3gmf.apps.googleusercontent.com";
                    options.ClientSecret = "sVDWez0nZHEzLiSyx165YToF";
                });

            var builder …
Run Code Online (Sandbox Code Playgroud)

c# openid asp.net-core identityserver4 asp.net-core-3.0

5
推荐指数
1
解决办法
3981
查看次数