headless_lms_server::domain::authorization

Function async_http_client_with_headers

Source
async fn async_http_client_with_headers(
    oauth_request: HttpRequest,
) -> Result<HttpResponse, HttpClientError<Error>>
Expand description

HTTP Client used only for authenticating with TMC server. This function:

  1. Ensures TMC server does not rate limit auth requests from backend by adding a special header
  2. Converts between oauth2 crate’s internal http types and our reqwest types:
    • Converts oauth2::HttpRequest to a reqwest::Request
    • Makes the request using our REQWEST_CLIENT
    • Converts the reqwest::Response back to oauth2::HttpResponse