wip: oauth

This commit is contained in:
2024-10-13 22:12:43 +07:00
parent e9f32fc32e
commit b7150c7c43
14 changed files with 234 additions and 65 deletions

View File

@@ -41,18 +41,18 @@ builder.Services.AddAuthentication()
}
};
// b.Events = new JwtBearerEvents()
// {
// OnMessageReceived = (ctx) =>
// {
// if (ctx.Request.Query.ContainsKey("token"))
// {
// ctx.Token = ctx.Request.Query["token"];
// }
//
// return Task.CompletedTask;
// }
// };
b.Events = new JwtBearerEvents()
{
OnMessageReceived = (ctx) =>
{
if (ctx.Request.Query.ContainsKey("token"))
{
ctx.Token = ctx.Request.Query["token"];
}
return Task.CompletedTask;
}
};
});
builder.Services.AddAuthorization();