How do I only let people with certain subscription acces a page
How do I only let people with certain subscription acces a page. I have 3 subscriptions how would i limit acces to certain pages or parts per subscription plan.
For example i have the /dashboard route which has different kinds of pages on its route. I only want people with a paying subscription plan to be able to access them and if they are not paying redirect them to the pricing page/
6 Replies
Hi @Sven. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Hmm, I don't know enough to give you a confident answer yet. The knowledge sources provided do not contain specific information on how to restrict access to pages based on subscription levels in Wasp.
However, Wasp does support access control on a per-entity basis as mentioned in this Github issue (https://github.com/wasp-lang/wasp/issues/584), and it also supports authentication requirements for pages as described in the Wasp documentation (https://wasp-lang.dev/docs/auth/overview#protecting-a-page-with-authrequired).
You might be able to combine these features to achieve your goal, but without more specific information or examples, it's hard to provide a definitive answer. I recommend checking the Wasp documentation or reaching out to the Wasp community for more guidance.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @Sven, 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?
Would like some help on this
Got it
OpenSaaS has Authorization example page where you can do something based on subscription status https://docs.opensaas.sh/guides/authorization/
or on other fields that use has https://docs.opensaas.sh/general/user-overview/#subscription-plans
OpenSaaS.sh
Authorization
Open SaaS is a free, open-source, full-stack SaaS starter kit for React + NodeJS.
OpenSaaS.sh
User Overview
Open SaaS is a free, open-source, full-stack SaaS starter kit for React + NodeJS.
However, does this also protect actions and queries i have? And this is only frontent security right?
Context, tokens, checking roles, there's a lot of ways -- have you used Cursor or zed? You can have it scan your code base and work from there - it's more efficient than asking implementation questions that are not really wasp specific
That's a good starting point, yes. Thanks for sharing with the bot!
Hey @Adam, thanks for jumping in!
@Sven This is definitely good advice (or even Googling wihout AIs like in the olden days).
No worries though, new users have trouble understanding what' s Wasp-specific and what isn't. That's perfectly normal. And sometimes, something that might sound general actually can become Wasp-specific (because Wasp provides a first-class construct that solves it).
So, in the future, perhaps it's best to phrase your question along the lines of "Does Wasp provide this functionality: ...."