Function Store
  • Home
  • Getting started
    • Introduction
    • Installing a function
    • Reconfiguring a function
    • Uninstalling a function
    • FAQs
  • Reference
    • Requirements
      • Assign Roles
        • User permissions
      • Link a Billing account to your project
      • Enable the APIs
    • Projects
      • How to add a project
      • How to set up a project
    • Functions
      • Benefits
      • Use cases
      • Authentication when installing
      • Runtime configuration
      • Deploying with a ZIP file
    • Policies
      • How to add a Policy
      • How to remove a Policy
    • Authentication
      • Users
      • Roles
      • Permissions
    • Secrets
      • Creating a Secret
      • Using a Secret
      • Changing the value for a Secret
      • Deactivating a Secret
  • developers
    • Overview
    • Getting Started
    • Set up
    • Workspaces
      • Create a workspace
      • Workspace boilerplate
      • Node engines
    • Writing Functions
      • Function Anatomy
      • Configuration file
      • Function Triggers
      • Environment Variables
        • Type "text"
        • Type "number"
        • Type "email"
        • Type "url"
        • Type "json"
        • Type "boolean"
        • Type "select"
        • Type "multiselect"
        • Type "firestoreDocumentPath"
        • Type "firestoreCollectionPath"
        • Type "color"
      • Documentation
    • Push/Update your functions in the cloud
    • Continuous Integration
    • Publish functions in the Marketplace
    • Emulators
      • Initialize emulators in your workspace
      • Environment variables
      • Starting emulators
      • Testing your functions in the emulator
      • Importing existing data into local emulators
        • Exporting data from Cloud Firestore to local emulator
        • Exporting user accounts from Firebase to local emulator
    • Visual Studio Code Extension
      • Installing the extension
      • Extension UI
      • Functions list
      • Creating and editing functions
      • Emulators
      • Extension settings
      • Troubleshooting
        • "Command not found" error when executing a command
  • Billing
    • Understanding Billing
  • Security
    • Security
  • Resources
    • Events and Triggers
    • Best Practices
      • How to log events in functions?
    • Document your Functions
    • Editorial guidelines
    • Our Processes
      • Use Cases Analysis
  • Use cases
    • Custom Stripe Checkout
Powered by GitBook
On this page

Was this helpful?

  1. Reference
  2. Policies

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:

  1. Go to Function Store Marketplace.

  2. Choose a function, for example getAirlines.

  3. Click Install button in that function. This action opens a drawer.

  4. Go to the Policies section in the drawer.

  5. Click on the add button (+). This action opens a modal with the list of policies.

  6. In this example, click on the isAuth policy. You will find all the info about this policy on the right side.

  7. 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.

PreviousPoliciesNextHow to remove a Policy

Last updated 4 years ago

Was this helpful?