Browsers, mobile and other languages
Anything that can't hold a server key, or has no Slydog provider, evaluates flags over OFREP, OpenFeature's remote evaluation protocol. OpenFeature has OFREP providers for the web, mobile and many server languages.
Client keys
In an environment's SDK keys, choose + Client key. It
starts with sly_cli_ and is safe to ship in an app: it can only evaluate
flags marked Available to clients, for the context it sends. Every other
flag looks like it doesn't exist.
Anyone with your app can read the values of flags available to clients, so don't put secrets in them. Servers in other languages can use a server key over OFREP to see every flag.
In the browser
npm install @openfeature/web-sdk @openfeature/ofrep-web-provider
import { OpenFeature } from "@openfeature/web-sdk"
import { OFREPWebProvider } from "@openfeature/ofrep-web-provider"
await OpenFeature.setContext({ targetingKey: user.id, plan: user.plan })
await OpenFeature.setProviderAndWait(
new OFREPWebProvider({
baseUrl: "https://api.slydog.dev",
headers: { Authorization: "Bearer sly_cli_…" },
}),
)
const flags = OpenFeature.getClient()
const on = flags.getBooleanValue("new-checkout", false)
The web provider fetches every client flag for the context at once and refreshes them from time to time. Set the context before evaluating, and again when the user signs in or out.
Other languages
Use your language's OFREP provider from
the OpenFeature ecosystem (search for
OFREP), with the base URL https://api.slydog.dev and the header
Authorization: Bearer <key>.
The protocol
Or call it directly. Evaluate one flag:
curl https://api.slydog.dev/ofrep/v1/evaluate/flags/new-checkout \
-H "Authorization: Bearer sly_cli_…" \
-H "content-type: application/json" \
-d '{"context": {"targetingKey": "user-123", "plan": "pro"}}'
{
"key": "new-checkout",
"value": true,
"variant": "on",
"reason": "TARGETING_MATCH",
"metadata": { "flagVersion": 4 }
}
Or every flag the key can see, with POST /ofrep/v1/evaluate/flags and the
same body. It answers { "flags": [ … ] } with an ETag; send it
back as If-None-Match to get a 304 when nothing changed.
-
reasonisDISABLED(the flag is off),TARGETING_MATCH,SPLIT(a rollout) orDEFAULT. -
A flag that doesn't exist, or that the key can't see, answers
404with"errorCode": "FLAG_NOT_FOUND". - Browsers can call it from any origin.
- Slydog never stores the context. It counts each context toward monthly active users by its kind and a hash of its key.