Install SDK Client
To get started, install the OpenFGA SDK packages.
- Node.js
- Go
- .NET
- Python
- Java
- CLI
You can find the Node.js package on npm at: @openfga/sdk.
Using npm:
npm install @openfga/sdk
Using yarn:
yarn add @openfga/sdk
You can find the Go package on GitHub at: @openfga/go-sdk.
To install:
go get -u github.com/openfga/go-sdk
In your code, import the module and use it:
import (
openfga "github.com/openfga/go-sdk"
)
func main() {
configuration, err := openfga.NewConfiguration(openfga.Configuration{
ApiUrl: os.Getenv("FGA_API_URL"), // required, e.g. https://api.fga.example
})
if err != nil {
// .. Handle error
}
}
You can then run
go mod tidy
to update go.mod
and go.sum
if you are using them.
The OpenFGA .NET SDK is available on NuGet.
You can install it using:
- The dotnet CLI:
dotnet add package OpenFGA.Sdk
- The Package Manager Console inside Visual Studio:
Install-Package OpenFGA.Sdk
- Visual Studio, Visual Studio for Mac and IntelliJ Rider: Search for and install
OpenFGA.Sdk
in each of their respective package manager UIs.
The OpenFGA Python SDK is available on PyPI.
To install:
pip3 install openfga_sdk
In your code, import the module and use it:
import openfga_sdk
You can find the Java package on Maven Central.
Using Maven:
<dependency>
<groupId>dev.openfga</groupId>
<artifactId>openfga-sdk</artifactId>
<version>0.3.1</version>
</dependency>
Using Gradle:
implementation 'dev.openfga:openfga-sdk:0.3.1'
The OpenFGA CLI is available on GitHub.
To install:
Brew
brew install openfga/tap/fga
Linux (deb, rpm and apk) packages
Download the .deb, .rpm or .apk packages from the releases page.
Debian:
sudo apt install ./fga_<version>_linux_<arch>.deb
Fedora:
sudo dnf install ./fga_<version>_linux_<arch>.rpm
Alpine Linux:
sudo apk add --allow-untrusted ./fga_<version>_linux_<arch>.apk
Docker
docker pull openfga/cli; docker run -it openfga/cli
Go
note that the command will be named
cli
go install github.com/openfga/cli@latest
Manually
Download the pre-compiled binaries from the releases page.