title | sidebar_position | slug | description |
---|---|---|---|
Install SDK Client |
2 |
/getting-started/install-sdk |
Installing SDK client |
import { SupportedLanguage, languageLabelMap, DocumentationNotice, ProductConcept, ProductName, ProductNameFormat, RelatedSection, } from '@components/Docs'; import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';
To get started, install the SDK packages.
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 .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 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 CLI is available on GitHub.
To install:
brew install openfga/tap/fga
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 pull openfga/cli; docker run -it openfga/cli
note that the command will be named
cli
go install github.com/openfga/cli@latest
Download the pre-compiled binaries from the releases page.
<RelatedSection description="Get {ProductName}'s SDKs to add authorization to your API." relatedLinks={[ { title: '{ProductName} Node.js SDK', description: 'Install our Node.js & JavaScript SDK to get started.', link: 'https://www.npmjs.com/package/@openfga/sdk', }, { title: '{ProductName} Go SDK', description: 'Use our Go SDK to easily connect your Go application to the {ProductName} API', link: 'https://github.com/openfga/go-sdk', }, { title: '{ProductName} .NET SDK', description: 'Connect your .NET service with {ProductName} using our .NET SDK', link: 'https://github.com/openfga/dotnet-sdk', }, { title: '{ProductName} Python SDK', description: 'Connect your Python service with {ProductName} using our Python SDK', link: 'https://github.com/openfga/python-sdk', }, { title: '{ProductName} Java SDK', description: 'Connect your Java service with {ProductName} using our Java SDK', link: 'https://github.com/openfga/java-sdk', } ]} />