Closed tekanic closed 9 months ago
@tekanic this sounds like a great idea! Is this something you think you would be able to contribute towards?
The existing amber generate api Post title:string body:text
will create a different pipeline:
pipeline :api do
plug Amber::Pipe::Error.new
plug Amber::Pipe::Logger.new
plug Amber::Pipe::Session.new
plug Amber::Pipe::CORS.new
end
You can add a new Pipe that decodes the token with this JWT library: https://github.com/crystal-community/jwt
What @drujensen said. In addition it's currently setup to send an encrypted json block back with set-cookie
header. I don't think we really gain anything by switching to JWT that isn't already happening, unless you intend for the client to be able to modify the token.
I agree that there is no reason to assume that someone would want JWT by default. HTTP session and cookie are more than enough for a default, and they create far less headache on the front-end, too.
A solution has been provided and no updates on this feature for almost a year. It is safe to close and if we really need JWT a new feature request can be open.
[Feature Request]
It would be great if the project generator automatically created the necessary pipes and endpoints with jwt configured if you specify --api when creating a new project.