2021年2月7日星期日

www-authenticate bearer token authorization in httr

I am attempting to use a username / password provided by a proprietary website to authenticate access to a data set API with httr.

The current iteration of my API call is

response <- GET("https://thiswebsite.com/api/endpoint",                  add_headers(Authorization = paste("Bearer", jsonlite::base64_enc(paste0(username,":",password)))))  

The response is 401 and headers are:

[1] "date : Mon, 08 Feb 2021 01:43:24 GMT"  [1] "content-type : application/json; charset=utf-8"  [1] "content-length : 61"  [1] "cache-control : no-cache"  [1] "pragma : no-cache"  [1] "expires : -1"  [1] "server : Microsoft-IIS/8.5"  [1] "x-aspnet-version : 4.0.30319"  [1] "www-authenticate : Bearer"  [1] "x-powered-by : ASP.NET"  

There are two cookies set in the headers as well.

From what I can find and understand of documentation I don't have enough information to authenticate, but communication is difficult with the API creator and I was hoping I could get insights or pointed in the right direction before I go down that road.

https://stackoverflow.com/questions/66095092/www-authenticate-bearer-token-authorization-in-httr February 08, 2021 at 10:07AM

没有评论:

发表评论