Thanks to visit codestin.com
Credit goes to lib.rs

#token-management #sdk #realm #federation #auth-token #access-token

federated-auth-realm-sdk-rust

Federated Auth Realm Rust SDK for authentication and token management

2 releases

0.4.12 Jan 24, 2026
0.4.4 Jan 9, 2026

#1114 in Authentication

MIT license

14KB
82 lines

Federated Auth Realm Rust SDK

A comprehensive Rust SDK for Federated Auth Realm, providing authentication, token management, and basic API calls.

Features

  • Authenticate with username/password
  • Token management (access/refresh)
  • Async API calls with reqwest
  • Extensible for SRWP discovery

Project layout

├── Cargo.toml                # Package manifest
├── src
│   ├── lib.rs                # Library entry point
│   └── client.rs             # Auth client implementation
├── tests
│   └── client_tests.rs       # Unit tests
├── example
│   └── main.rs               # Usage example

Getting started

  1. Build the library
cargo build
  1. Run tests
cargo test
  1. Format and lint
cargo fmt --all
cargo clippy --all-targets --all-features -- -D warnings

Usage

use federated_auth_realm_sdk::AuthClient;

#[tokio::main]
async fn main() {
 let client = AuthClient::new("https://api.example.com");
 match client.login("user", "pass").await {
  Ok(token) => println!("Access token: {}", token.access_token),
  Err(e) => eprintln!("Login failed: {}", e),
 }
}

 ## Publishing to crates.io

 To publish the package, ensure you have a valid `.env` file with your `CARGO_REGISTRY_TOKEN`.

 Run:

Contributing

If you want to publish with a dirty working directory (not recommended), use:

./scripts/deploy.sh --allow-dirty

This will pass the --allow-dirty flag to cargo publish.

  • Format: cargo fmt --all
  • Lint: cargo clippy --all-targets --all-features -- -D warnings
  • Tests: cargo test

License

MIT

Dependencies

~6–22MB
~263K SLoC