I getting below exception -in implicit mode with vue.js
This site can’t be reachedThe webpage at http://localhost:5000/Account/Login?ReturnUrl=%2Fconnect%2Fauthorize%2Fcallback%3Fclient_id%3DVuejs%26redirect_uri%3Dhttp%253A%252F%252Flocalhost%253A8484%252Flogin%26response_type%3Did_token%2520token%26scope%3Dopenid%2520profile%2520courses%2520roles%2520country%2520GPSSchoolAPI%26state%3D5b7f679b185642db87a745f649dab48f%26nonce%3D9f222f460a974434a6d0a7179d79765a might be temporarily down or it may have moved permanently to a new web address. ERR_RESPONSE_HEADERS_TOO_BIG
Log on console
Executed action method TIS.IdentityServer.Controllers.Account.AccountController.Login (TIS.IdentityServer), returned result Microsoft.AspNetCore.Mvc.RedirectResult in 65364.2974ms.
info: Microsoft.AspNetCore.Mvc.Infrastructure.RedirectResultExecutor[1]
Executing RedirectResult, redirecting to /connect/authorize/callback?client_id=Vuejs&redirect_uri=http%3A%2F%2Flocalhost%3A8484%2Flogin&response_type=id_token%20token&scope=openid%20profile%20courses%20roles%20country%20GPSSchoolAPI&state=5b7f679b185642db87a745f649dab48f&nonce=9f222f460a974434a6d0a7179d79765a.
info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[2]
Executed action TIS.IdentityServer.Controllers.Account.AccountController.Login (TIS.IdentityServer) in 65380.1296ms
info: Microsoft.AspNetCore.Routing.EndpointMiddleware[1]
Executed endpoint 'TIS.IdentityServer.Controllers.Account.AccountController.Login (TIS.IdentityServer)'
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
Request finished in 65421.3075ms 302
configuration
export const oidcSettings = {
authority: 'http://localhost:5000',
client_id: 'Vuejs',
redirect_uri: 'http://localhost:8484/login',
response_type: 'id_token token',
scope:'openid profile courses roles country GPSSchoolAPI',
post_logout_redirect_uri: 'http://localhost:8484/index.html',
//userStore: new Oidc.WebStorageStateStore(),
loadUserInfo: true,
filterProtocolClaims: true
}
landing component
<script>
import { mapActions, mapGetters } from 'vuex'
export default {
name: "login",
data: () => {
return {
IsLogin: true,
IsForgotPassword: false,
//loginleftbg: 'http://localhost/my-project2/src/assets/images/login_side_bg.png',
LogoUrl: process.env.ROOT_API_IMG + 'logo.png',
regionalIcon: process.env.userTypeIconPath + 'regional-head.png',
ceoIcon: process.env.userTypeIconPath + 'ceo.png',
principalIcon: process.env.userTypeIconPath + 'principal.png',
teacherIcon: process.env.userTypeIconPath + 'teacher.png',
studentIcon: process.env.userTypeIconPath + 'student.png',
parentIcon: process.env.userTypeIconPath + 'parent.png',
governmentIcon: process.env.userTypeIconPath + 'government.png'
}
},
methods: {
NavigateTo(name, uuid) {
this.$router.push({name: name, params: {uuid: uuid}});
},
...mapActions( [
'oidcSignInCallback'
])
},
computed:{
...mapGetters([
'oidcUser'
])
},
created(){
this.oidcSignInCallback()
.then((redirectPath) => {
// this.$router.push({name: 'admin'})
// this.redirectToUser('admin','admin')
})
.catch((err) => {
console.error("hjk"+err)
this.$router.push('/oidc-callback-error') // Handle errors any way you want
})
},
mounted(){
}
};
</script>
<div>
<h1>Login successful</h1>
<p>Your browser should be redirected soon</p>
<!-- <p v-if="oidcUser">User: {{oidcUser}} </p>-->
</div>
I am using Asp.net core Identity for user management and for that the configuration is as below
public void ConfigureServices(IServiceCollection services)
{
services.Configure<CookiePolicyOptions>(options =>
{
// This lambda determines whether user consent for non-essential cookies is needed for a given request.
options.CheckConsentNeeded = context => true;
options.MinimumSameSitePolicy = SameSiteMode.None;
});
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
// services.AddSpaStaticFiles();
services.AddCors(options =>
{
options.AddPolicy("CorsPolicy",
builder => builder.AllowAnyOrigin()
.AllowAnyMethod()
.AllowAnyHeader()
.AllowCredentials());
});
var config = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json", false)
.Build();
string connectionStringData = config.GetSection("ConnectionStrings:identityServerDataDB").Value;
string connectionStringUser = config.GetSection("ConnectionStrings:tisUserDataDB").Value;
var migrationAssembly = typeof(Startup).GetTypeInfo().Assembly.GetName().Name;
// for user add the DBcontext.
services.AddDbContext<ApplicationDbContext>(option => {
option.UseSqlServer(connectionStringUser);
});
services.AddIdentity<ApplicationUser,IdentityRole>()
.AddEntityFrameworkStores<ApplicationDbContext>()
.AddDefaultTokenProviders();
services.AddScoped<IUserClaimsPrincipalFactory<ApplicationUser>, TISUserClaimsPrincipalFactory>();
// services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme);
services.AddIdentityServer(options=> {
options.Events.RaiseErrorEvents = true;
options.Events.RaiseFailureEvents = true;
options.Events.RaiseInformationEvents = true;
options.Events.RaiseSuccessEvents = true;
})
.AddDeveloperSigningCredential()
//.AddTestUsers(Config.GetUsers())
.AddAspNetIdentity<ApplicationUser>()
// Configuration Store : Clients and Resource
.AddConfigurationStore(option =>
{
option.ConfigureDbContext = b => b.UseSqlServer(connectionStringData, sql => sql.MigrationsAssembly(migrationAssembly));
})
// Operational Store: tokens concent code etc.
.AddOperationalStore(option => {
option.ConfigureDbContext = b => b.UseSqlServer(connectionStringData, sql => sql.MigrationsAssembly(migrationAssembly));
});
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
InitializeIdentityServerDatabase(app);
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseStaticFiles();
app.UseAuthentication();
app.UseDefaultFiles();
app.UseIdentityServer();
// app.UseSpaStaticFiles();
app.UseMvcWithDefaultRoute();
}
the issue was in Cookies, the size was getting increased due to data, after decreasing it, it worked.