How to Restrict Pages without User List

Just found Wappler a few days back and am excited to see if it could be the answer i have been looking for.

I have an Azure Cosmos DB database where i store user account details, game subscription details, saved games progress details etc. I have an Azure Functions app that has all the APIs to get/update these details.

I want to know if I can use Wappler to build the front end only.

How would i restrict access to certain pages to users with a valid subscription only?
I want to call my Azure functions API and if result is that User has valid subscription then allow
access else deny.

From what i have understood so far The restricted Pages feature needs a Security Provider which in turn needs a Single User / Static Users List/ Database Connection.
I just want to allow / deny access based on response received from my Azure Functions API.
How would i do that?

Thanks for your help

Hi @rij, welcome to Wappler.

I assume that your database is available online. You should be able to create your login and security provider from your users table just as you would with any other database.

1 Like

Or use the API facilities within Server Connect?

1 Like

Hi Rij

I support @sitestreet idea. If there was a specific task to use only a third-party API and implement only a web interface, I would also limit myself to a simple server action. I would make a step in it to get information about the user, through the API step. Then I would create a validation condition. If the condition does not match, it starts the redirect step to the public page. It looks something like this:

This server action is then set on the page that should have restricted access.:

It’s worth noting that I’m showing this from a development perspective on node js.

It is also worth noting that sometimes it makes sense to spend a little more time and move the server part to your side. This can end up giving you much more flexibility than using the API and will save you a lot of time implementing complex UI logic.

1 Like

Thank you for the warm welcome. My database does not have tables just json files , it’s a NoSQL Db
so I’m not sure if it would work

Thank you so much for such a detailed reply.
Earlier i was using Unity to make the front end and it was working great, i could make UI that
called my APIs.
However i could see cross platform downloadable apps becoming a nightmare for me to maintain and
after trying some javascript based game engines i just became a fan of the speed and ease of web based front ends. Also the ease of publishing , updating, no more having to deal with app stores feels freeing.

Perhaps coming from Unity it’s difficult to wrap my head around database and APIs not being completely separated from the front end… Apart from time spent in Complex UI logic what factors should i be weighing while considering moving server part to Wappler as opposed to just moving the front end? I mean security etc ? Is it even possible with a NoSQL Db?

Thanks again for your help

As others have stated, using Wappler’s API Connector, you should be able to use the information stored in the Cosmos Database to secure the pages.

From what I have read, Microsoft has released SDKs for multiple programming languages including Java, .NET, Python, Node.js, JavaScript, etc… This looks like a unique opportunity to create a NodeJS website using Wappler. Feeling excited already.