Skip to main content
This article describes how to grant a user access to an object in OpenFGA.
When to useGranting access with relationship tuples is a core part of OpenFGA. Without relationship tuples, any checks will fail. You should use:
  • authorization model to represent what relations are possible between the users and objects in the system
  • relationship tuples to represent the facts about the relationships between users and objects in your system.

Before you start

Familiarize yourself with OpenFGA Concepts to understand how to develop a relationship tuple and authorization model. Assume that you have the following authorization model.
You have a type called document that can have a viewer and/or an editor.

In addition, you will need to know the following:

OpenFGA Concepts

  • A Type: a class of objects that have similar characteristics
  • A User: an entity in the system that can be related to an object
  • A Relation: a string defined in the type definition of an authorization model that defines the possibility of a relationship between an object of the same type as the type definition and a user in the system
  • An Object: represents an entity in the system. Users’ relationships to it can be define through relationship tuples and the authorization model
  • A Relationship Tuple: a grouping consisting of a user, a relation and an object stored in OpenFGA

Step By Step

For an application to understand that user x has access to document y, it must provide OpenFGA that information with relationship tuples. Each relationship tuple has three basic parameters: a user, a relation and an object.

01. Create A Relationship Tuple

Below, you’ll add a relationship tuple to indicate that bob is an editor of document:meeting_notes.doc by adding the following:

02. Check That The Relationship Exists

Once you add that relationship tuple to OpenFGA, you can check if the relationship is valid by asking if bob is an editor of document:meeting_notes.doc: Checking whether bob is an viewer of document:meeting_notes.doc returns false because that relationship tuple does not exist in OpenFGA yet.
When creating relationship tuples for OpenFGA, use unique ids for each object and user within your application domain. We’re using first names and simple ids to as an easy-to-follow example.
Check the following sections for more on how to model with OpenFGA.

OpenFGA Concepts

Learn about the OpenFGA Concepts.

Modeling: Getting Started

Learn about how to get started with modeling.

Configuration Language

Learn about OpenFGA Configuration Language.
Last modified on September 28, 2026