# Authenticate with OAuth Client Credentials
This walkthrough demonstrates how to exchange a Port OAuth client ID/secret for an access token and
verify the credentials by calling a simple API.
```rust
use port_sdk::{PortClient, PortConfig};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Reads PORT_CLIENT_ID / PORT_CLIENT_SECRET (and optional overrides) from .env or the shell.
let config = PortConfig::from_env()?;
let client = PortClient::from_config(config)?;
// Call a lightweight endpoint to ensure the token is valid.
let scorecards: serde_json::Value = port_sdk::apis::scorecards::list(&client).await?;
println!("{}", serde_json::to_string_pretty(&scorecards)?);
Ok(())
}
```
## Quick Start
1. Copy the example environment file and fill in the placeholders:
```bash
cp .env.example .env
$EDITOR .env
```
2. Populate at least `PORT_CLIENT_ID` and `PORT_CLIENT_SECRET`. Override `PORT_TOKEN_URL`
if your Port tenant exposes a custom token endpoint.
3. Run the sample with `cargo run --example oauth-client-credentials` once you convert this snippet
into a Rust example, or adapt it into your application/library code.