Closed frzambra closed 2 months ago
A dry run confirms that the header is being set correctly:
library(httr2)
request("http://agviewer.com/api/v1") |>
req_auth_basic(username = "usr", password = "pass") |>
req_url_path_append('/device/data') |>
req_dry_run(redact_headers = FALSE)
#> GET /api/v1/device/data HTTP/1.1
#> Host: agviewer.com
#> User-Agent: httr2/1.0.1.9000 r-curl/5.2.1 libcurl/8.4.0
#> Accept: */*
#> Accept-Encoding: deflate, gzip
#> Authorization: Basic dXNyOnBhc3M=
Created on 2024-07-02 with reprex v2.1.0
This suggests that the problem isn't your understand of httr2, but something with the API you trying to call.
Perhaps it's a minor mistake, but I've been trying for a while and googling, and I can't seem to get it.
When I run the first, I get the status "200 Ok," but when I append a path, I get "401 Unauthorized."