How to add a Policy
Follow these steps to add a policy.
The policy selected for this example is the isAuth. This policy verifies if the user is authenticated before executing the installed function. In case the user is unauthenticated, it will throw an HttpError.
If you want to use the isAuth policy, follow these steps:
Go to Function Store Marketplace.
Choose a function, for example getAirlines.
Click Install button in that function. This action opens a drawer.
Go to the Policies section in the drawer.
Click on the add button (+). This action opens a modal with the list of policies.
In this example, click on the isAuth policy. You will find all the info about this policy on the right side.
If you're sure about adding this policy to your function after reading the info, click Add button. You will see that the policy is added to the drawer.
Now, you can fill in the form and install the function. If all goes well, right now you have a function installed in your apps' backend that will only run when a user is authenticated. This is because you added this policy to the function.
You can add as many policies as you want, and the order doesn't matter.
Last updated