Navigation
  • Realm >
  • Values & Secrets

Values & Secrets

Introduction

Realm Values and Realm Secrets are static, server-side constants that you can access or link to from other components of your application. You can access Values directly from Realm Functions and Rule expressions and link Secrets to configuration values for authentication providers.

Concepts

Value

A value is a named reference to a piece of static data stored by MongoDB Realm that you can access in Realm Functions and Realm Rules. Values provide an alternative to hardcoding configuration constants directly into your Functions and Rules. In other words, Value allow you to separate deployment-specific configuration data from the business logic of your app.

Realm Values can resolve to two types of data:

  • A plain text Value resolves to a regular JSON object, array, or string that you define.
  • A secret Value resolves to the value of a Secret.

Secret

A Secret is a private value that is stored on the MongoDB Realm backend, hidden from users, and not included in exported applications. Secrets are useful for storing sensitive information such as an API key or an internal identifier.

You cannot directly read the value of a Secret after defining it. Instead, you link to the Secret by name in authentication provider and service configurations. If you need to access the Secret from a Function or Rule, you can link the Secret to a Value.

Summary

  • Realm Values and Realm Secrets are server-side constants you can use in your Realm app.
  • Realm Values allow you to separate deployment-specific configuration data from the business logic of your app.
  • Realm Secrets store sensitive data. You cannot export or directly read a Secret. Instead, you access a Secret indirectly via a named Realm Value.