Skip to main content

Yandex Disk

Yandex Disk REST API requests to cloud-api.yandex.net authenticated with an OAuth access token. The API version, resource path, query parameters, upload or download URLs, and storage parameters stay with the caller.

OAuth access token✓ header signing— query / presign✓ WASMdocs.rs/reqsign-yandex-disk ↗

Inserts a sensitive Authorization: OAuth header and leaves the URI and every other header unchanged; expires_in is rejected because Yandex Disk has no query authentication.

Get started​

cargo add reqsign --features yandex-disk
use reqsign::{default_context, yandex_disk};

// Yandex Disk has no documented automatic token source.
let ctx = default_context();
let signer = yandex_disk::default_signer(ctx, "yandex-disk-oauth-token");

let mut req = http::Request::get(
"https://cloud-api.yandex.net/v1/disk/resources?path=disk%3A%2Ffolder%2Ffile",
)
.body(())
.unwrap()
.into_parts()
.0;

// Adds Authorization: OAuth <token> and leaves the URI unchanged.
signer.sign(&mut req, None).await?;

The Yandex Disk REST API authenticates requests with Authorization: OAuth <access token>. The token is issued by Yandex OAuth to an app for a specific user's Disk.

Yandex documents no environment variable, CLI token store, or well-known credential file for these tokens, so Reqsign does not infer one. default_signer therefore takes the token explicitly, and DefaultCredentialProvider::new() has an empty automatic chain. Compose StaticCredentialProvider with push_front, or supply a dynamic ProvideCredential when the token rotates:

use reqsign::{Context, Signer};
use reqsign::yandex_disk::{RequestSigner, StaticCredentialProvider};

let provider = StaticCredentialProvider::new("yandex-disk-oauth-token");
let signer = Signer::new(ctx, provider, RequestSigner);

Token issuance, refresh, revocation, and the permissions attached to the OAuth app stay with the caller. Reqsign does not implement authorization-code, device, or interactive flows. A static token without an expiry is cached for the signer's lifetime; use StaticCredentialProvider::with_expires_at when the token has a known fixed lifetime, or a dynamic ProvideCredential that returns a fresh credential with an expiry when the token rotates.

Request ownership​

The caller owns the API host, API version, resource path, query parameters, Accept and Content-Type headers, and any upload or download URL returned by Yandex Disk. The signer inserts a sensitive Authorization header and preserves the URI and every other header. There is no query authentication, so signing rejects expires_in.

Credentials

Default credential chain

This provider has no ambient default source. Supply an explicit credential provider as described on this page.

Credential providers

Available ProvideCredential implementations. Construct any of them directly, reorder them, or compose them into your own chain — see Loading credentials: