get_default_access_token_key (src/access_token.rs)

hyperswitch · crates/common_utils/src/access_token.rs · rust · Apache-2.0
auth, tag:embed-classified

Utility to generate default Redis key for access tokens per merchant and connector.

// Source: https://github.com/juspay/hyperswitch | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
//! Commonly used utilities for access token
use std::fmt::Display;

use crate::id_type;

/// Create a default key for fetching the access token from redis
pub fn get_default_access_token_key(
    merchant_id: &id_type::MerchantId,
    merchant_connector_id_or_connector_name: impl Display,
) -> String {
    format!(
        "access_token_{}_{}",
        merchant_id.get_string_repr(),
        merchant_connector_id_or_connector_name
    )
}

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key