'Implementation of Openiddcit authorization in NestJS when the authentication server is written in .Net
I'm trying to implement authorization on NestJS OpenID connect. An authentication server (hereinafter the server) written in Net C# Web.API is allocated for the entire application. There are also several additional Net Web.APIs that interact correctly with my server, and the code is quite small
builder.Services
.AddOpenIddict()
.AddValidation(options =>
{
options.SetIssuer("<issuer>");
options.UseSystemNetHttp();
options.UseAspNetCore();
});
Since I'm new to NestJS, I can't get my NestJS to work properly with my server, the maximum I've reached is getting.well-known/OpenID-configuration
export const buildOpenIdClient = async () => {
const issuer = await Issuer.discover(`server/.well-known/openid-configuration`);
// Because TypeError: authorization_endpoint must be configured on the issuer (don't know how fix)
issuer['authorization_endpoint'] = 'server/auth_endpoint';
//I Accept Anonymous Clients
return new issuer.Client({
client_id: "todo",
client_secret: "todo",
});
};
Also I have a error: TypeError: authentication requires session support, The internet says that I need to add this line
await app.use(session({ secret: 'you secret', saveUninitialized: true, resave: true }));
but I don't have a secret key in this place.
Is there some elegant solution or am I moving in the wrong direction at all?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
