api

can you still use context.entities in wasp apis even if there’s no logged-in user
1 Reply
kapa.ai
kapa.ai4w ago
Hi @Bruno Njeru. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Yes. You can access context.entities in an API regardless of whether a user is logged in. Entities are injected based on the api declaration (entities: [...]), and auth is controlled separately via the auth field. If you don’t need user info, set auth: false or omit it when auth isn’t enabled; you’ll still get context.entities for Prisma access (see examples showing entities injection independent of context.user) (Using entities in APIs). When auth is enabled and auth: true, context.user will be available in addition to entities, but entities themselves don’t depend on having a logged-in user (API reference, Defining the API’s NodeJS implementation). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @Bruno Njeru, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?

Did you find this page helpful?