[ ] Regression
[ ] Bug report
[ ] Feature request
[*] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
The guide over at https://docs.nestjs.com/techniques/authentication has some concept of a users model for authentication, however the sample at https://github.com/nestjs/nest/tree/master/sample/19-auth is totally barebones and only uses a hardcoded email.
Likewise, the authentication page doesn't provide a lot of information about some very common use cases for authentication (Though it's somewhat assisted by https://docs.nestjs.com/guards & https://docs.nestjs.com/custom-decorators)
I understand the sample is supposed to be extremely storage-agnostic, but perhaps some example could be done that's entirely in memory? It'd be great to see the following:
Authentication is a pretty core part of web apps, I think this would be very worthwhile to flesh out.
until the docs are updated, you can check out my repo https://github.com/bojidaryovchev/nest-angular/tree/master/src/server/modules/auth
@bojidaryovchev Your solution does not seem to work in V5
I know that, I've reported it already in an issue.. Generally the consumer.apply(middleware).forRoutes(string) in v5 doesnt work, it only works if u pass a controller and we are therefore unable to configure middlewares for a single route.. I'm waiting for it to be resolved and a patch version to be published in order to update it.. The idea is the same tho
Excellent. Thanks!
@bojidaryovchev i have the same trouble, and waiting for solution too
This is even more complicated, because in version v4, forRoutes accept a string, an object of { path, method } <- this was freaking useful, and whole controller. @kamilmysliwiec could you revert this change to accept back again the { path, method } object?
Imagine situation like that:
/auth/token
<- POST
/auth/token
<- GET
When you're doing POST
you might not need to setup some middleware for that route, but only for GET
now this is impossible to achieve that. But it was, and was useful as hell.
Regards.
Let's track this issue here https://github.com/nestjs/docs.nestjs.com/issues/99
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
This is even more complicated, because in version v4, forRoutes accept a string, an object of { path, method } <- this was freaking useful, and whole controller. @kamilmysliwiec could you revert this change to accept back again the { path, method } object?
Imagine situation like that:
/auth/token
<- POST/auth/token
<- GETWhen you're doing
POST
you might not need to setup some middleware for that route, but only forGET
now this is impossible to achieve that. But it was, and was useful as hell.Regards.