Install SDK Client
To get started, install the OpenFGA SDK packages.
- Node.js
- Go
- .NET
- Python
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{
ApiScheme: os.Getenv("FGA_API_SCHEME"), // optional, defaults to "https"
ApiHost: os.Getenv("FGA_API_HOST"), // required, define without the scheme (e.g. api.openfga.example instead of https://api.openfga.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