| Crates.io | openfga-client |
| lib.rs | openfga-client |
| version | 0.4.0 |
| created_at | 2025-02-25 19:49:26.025906+00 |
| updated_at | 2025-09-23 10:03:48.336454+00 |
| description | Type-safe client SDK for OpenFGA with optional Authorization Model management and Authentication (Bearer or Client Credentials). |
| homepage | |
| repository | https://github.com/vakamo-labs/openfga-client.git |
| max_upload_size | |
| id | 1569504 |
| size | 1,419,697 |
OpenFGA Rust Client is a type-safe gRPC client for OpenFGA with optional Authorization Model management and Authentication (Bearer or Client Credentials).
tonicvendored-protoc for well-known types - Rust files are pre-generated.auth-middle)read_all_tuples (handles pagination), get_store_by_name and more.use openfga_client::client::OpenFgaServiceClient;
use tonic::transport::Channel;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let endpoint = "http://localhost:8081";
let service_client = OpenFgaServiceClient::connect(endpoint).await?;
// Use the client to interact with OpenFGA
Ok(())
}
use openfga_client::{client::BasicOpenFgaServiceClient, url};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let endpoint = url::Url::parse("http://localhost:8081")?;
let token = "your-bearer-token";
let service_client = BasicOpenFgaServiceClient::new_with_basic_auth(endpoint, token)?;
// Use the client to interact with OpenFGA
Ok(())
}
use openfga_client::client::BasicOpenFgaServiceClient;
use url::Url;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let endpoint = Url::parse("http://localhost:8081")?;
let client_id = "your-client-id";
let client_secret = "your-client-secret";
let token_endpoint = Url::parse("http://localhost:8081/token")?;
let scopes = vec!["scope1", "scope2"];
let service_client = BasicOpenFgaServiceClient::new_with_client_credentials(endpoint, client_id, client_secret, token_endpoint, &scopes).await?;
// Use the client to interact with OpenFGA
Ok(())
}
This project is licensed under the Apache-2.0 License. See the LICENSE file for details.
Contributions are welcome! Please open an issue or submit a pull request on GitHub.
See DEVELOPMENT.md for some tips.