Skip to main content

Crate openfga

Crate openfga 

Source
Expand description

§OpenFGA Rust SDK

Async Rust client for OpenFGA — the open-source authorization system inspired by Google Zanzibar.

§Quick start

use openfga::prelude::*;
use openfga::apis::{configuration::Configuration, stores_api};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let config = Configuration::builder()
        .base_path("https://api.fga.example.com")
        .bearer_token("my-token")
        .build();

    let stores = stores_api::list_stores(&config, None, None, None).await?;
    println!("{:?}", stores);
    Ok(())
}

§Auth methods

Use [configuration::ConfigurationBuilder] to set exactly one auth method:

MethodBuilder call
Bearer token.bearer_token("…")
OAuth2 token.oauth_token("…")
Basic auth.basic_auth("user", Some("pass"))
API key.api_key("key", Some("prefix"))

Modules§

apis
models
prelude
Re-exports of the most commonly used types.