ConfigsApr 16, 2026·3 min read

OpenFGA — Fine-Grained Authorization at Scale

Model and evaluate complex permission policies with a relationship-based authorization system. Inspired by Google Zanzibar and backed by the CNCF.

TL;DR
OpenFGA models complex permissions as relationships using a Zanzibar-inspired DSL and evaluates them at scale.
§01

What it is

OpenFGA is an open-source fine-grained authorization system backed by the CNCF. It is inspired by Google's Zanzibar paper and uses a relationship-based access control (ReBAC) model. You define authorization policies as relationships between users and objects using a simple DSL, and OpenFGA evaluates access checks in milliseconds.

OpenFGA targets backend developers and platform engineers who need authorization beyond simple RBAC. If your application has complex permission hierarchies -- document sharing, team-based access, organizational policies -- OpenFGA models these as relationship tuples.

§02

How it saves time or tokens

Implementing fine-grained authorization from scratch requires building a policy engine, a tuple store, and evaluation logic. OpenFGA provides all three out of the box. The authorization model DSL lets you express complex policies in a few lines, and the API handles evaluation, caching, and consistency.

For AI applications, OpenFGA can control which users or agents can access specific resources, datasets, or model endpoints. This is particularly useful for multi-tenant AI platforms.

§03

How to use

  1. Start OpenFGA with Docker:
docker pull openfga/openfga
docker run -p 8080:8080 -p 3000:3000 openfga/openfga run
  1. Create a store and define an authorization model:
curl -X POST http://localhost:8080/stores \
  -H 'Content-Type: application/json' \
  -d '{"name": "my-app"}'
  1. Write relationship tuples and check access via the REST API.
§04

Example

# Authorization model DSL
model
  schema 1.1

type user

type document
  relations
    define owner: [user]
    define editor: [user] or owner
    define viewer: [user] or editor
# Write a relationship tuple
curl -X POST http://localhost:8080/stores/{store_id}/write \
  -H 'Content-Type: application/json' \
  -d '{
    "writes": {
      "tuple_keys": [
        {"user": "user:alice", "relation": "owner", "object": "document:report"}
      ]
    }
  }'

# Check access
curl -X POST http://localhost:8080/stores/{store_id}/check \
  -H 'Content-Type: application/json' \
  -d '{"tuple_key": {"user": "user:alice", "relation": "viewer", "object": "document:report"}}'
# Returns: {"allowed": true}
§05

Related on TokRepo

  • Security tools -- Browse other authorization and security tools
  • API tools -- Explore API security and gateway solutions
§06

Common pitfalls

  • Authorization models must be written in OpenFGA's DSL, not arbitrary JSON. Syntax errors in the model definition produce cryptic error messages. Use the OpenFGA Playground to validate models before deploying.
  • Relationship tuples accumulate over time. Without cleanup of stale tuples (e.g., when users leave an organization), the tuple store grows and check latency increases.
  • OpenFGA evaluates authorization at request time. For pages showing many resources, batch the check calls using the list-objects API instead of making individual check calls per resource.

Frequently Asked Questions

What is the difference between OpenFGA and traditional RBAC?+

RBAC assigns roles to users globally. OpenFGA uses relationship-based access control where permissions are defined as relationships between specific users and specific objects. This enables fine-grained policies like 'Alice can edit this document' rather than 'editors can edit all documents'.

How does OpenFGA compare to OPA (Open Policy Agent)?+

OPA evaluates policies written in Rego against request data. OpenFGA evaluates relationship-based access checks against stored tuples. OPA is more general-purpose; OpenFGA is optimized for authorization with built-in tuple storage and relationship traversal.

Does OpenFGA scale for production use?+

Yes. OpenFGA is designed for production workloads with sub-millisecond check latency. It supports PostgreSQL and MySQL as backend stores for persistence. The CNCF backing ensures ongoing development and stability.

Can I use OpenFGA with my existing authentication system?+

Yes. OpenFGA handles authorization only, not authentication. It works alongside any authentication provider (Auth0, Keycloak, Firebase Auth). After authenticating a user, you pass their identity to OpenFGA for authorization checks.

Does OpenFGA have SDK support?+

Yes. OpenFGA provides official SDKs for JavaScript, Python, Go, .NET, and Java. The SDKs wrap the REST API with typed interfaces for writing tuples, checking access, and managing authorization models.

Citations (3)

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets