Encore framework integration
Provide an example of correct integration with the encore framework.
https://encore.dev/docs/ts/develop/auth
https://github.com/encoredev/encore
Encore — Open Source Backend Framework for robust distributed systems
Authenticating users
Learn how to add authentication to your APIs and make sure you know who's calling your backend APIs.
GitHub
GitHub - encoredev/encore: Open Source Development Platform for bui...
Open Source Development Platform for building robust type-safe distributed systems with declarative infrastructure - encoredev/encore
3 Replies
Hello, Manix.
It seems that you would like to use Kinde as the authentication front of an app that uses this framework, and you are asking us for an example of such implementation, can you confirm?
Assuming that this is the case, are there any specific expectations or requirements that you have for this implementation? Given that the documentation does not provide a direct example with this framework, I would ask for the following clarifications to help provide the most relevant guidance:
- What programming language are you using with Encore (TypeScript, Go, etc.)?
- Are you looking to authenticate users, APIs, or both with Kinde?
- Do you want to use OAuth 2.0, OpenID Connect, or another authentication protocol?
- Do you need an example for frontend, backend, or both?
- Are you already using any Encore authentication modules, or planning to build custom middleware?
- Do you have a specific user flow or endpoint you want protected?
- Are there any existing identity providers or legacy systems you need to integrate with Kinde?
Thanks in advance and looking forward to your response.
Hello. I want an example: a classic application (frontend<=>backend), and for m2m.
The most important requirement is speed and efficiency. Since encore is on average ~10 times faster than express.js, everything must be lightning fast.
Answers to your questions:
1) Encore typescript
2) In my case, I need classic user authentication for the part of the endpoints that uses the frontend (frontend<=>backend). And for the other part of the API endpoints, M2M authentication is required.
3) I am not competent in this matter, I need authorization for regular users email+magic link, authorization for corporate clients, as well as M2M (super speed is important for m2m) 4) Backend and frontend, use the client generated using
3) I am not competent in this matter, I need authorization for regular users email+magic link, authorization for corporate clients, as well as M2M (super speed is important for m2m) 4) Backend and frontend, use the client generated using
encore gen client
The client can be used both on the frontend and in other applications that will use M2M (in which case lightning speed is required for backend)
https://encore.dev/docs/ts/cli/client-generation
https://encore.dev/docs/ts/frontend/request-client
5) Encore has a special method for auth. Need to create an authentication handler, and then in any endpoints, you only need to specify auth: true to intercept any requests that contain an Authorization header
https://encore.dev/docs/ts/develop/auth
6) There is no specific flow, but there is a very important nuance. Encore has a core that creates and manages multiple nodeJS/bun processes (1 per core), which means that applications have real multithreading. Each NodeJS isolate is a separate JavaScript runtime, with its own event loop and memory space. To enable Worker Pooling, add "build": {"worker_pooling": true} to your encore.app file.
https://encore.dev/docs/ts/develop/multithreading#enabling-worker-pooling
7) zero legacyHello, Manix. I just wanted to let you know that the team is already analyzing this case to come back with a response.