hilla icon indicating copy to clipboard operation
hilla copied to clipboard

Make it easier to enable authentication when using File Router

Open cromoteca opened this issue 1 year ago • 1 comments
trafficstars

Describe your motivation

Hilla now generates many files automatically when using file router. Some of them need to be replaced with custom versions just to enable authentication, which is a need in almost all applications. That means giving up on automatic versions of those files.

At least index.tsx and routes.tsx need to be customized, and auth.ts added.

Describe the solution you'd like

The generated files already contain support for authentication and nothing happens if authentication is not used.

Describe alternatives you've considered

No response

Additional context

But not everything can be set up automatically, as the developer still needs to provide the endpoint used to get user information, so he has to create an auth.ts file manually, as per documentation.

cromoteca avatar Apr 10 '24 08:04 cromoteca

As discussed internally, we could use a Java interface to be implemented in an endpoint and, if that interface is found, that could trigger authentication support and could allow to generate all needed files, including auth.ts.

cromoteca avatar Apr 10 '24 08:04 cromoteca