curl GET request returning Unknown Error

response2 <- httr::GET('', config = (add_headers(Authorization = paste0('Bearer ', thetoken))))

Anyone think why this return an "UnknownError"

Response []
Date: 2020-07-27 01:31
Status: 401
Content-Type: application/json
Size: 1.57 kB
"error": {
"code": "UnknownError",
"message": "<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "
"innerError": {
"date": "2020-07-27T01:31:59",
"request-id": "995d167a-86c0-4b8b-915c-edae730780f9"

This error code is often link to Authentication

Try with paste() because I think there should be a space between bearer and the token.

Hope it helps.

Thanks @cderv. There is a space at the end of the 'Bearer ' string. Any way, I tried you suggestion, but no change. Same error.

1 Like

Oh I did not see it ! :sweat_smile:

Maybe an issue with the API. I don’t use this one specifically and can’t try it right now.

Was it working before or is it the first time you tried and it fails ?

No never had it working. It's Microsoft's key API for interacting with Office 365, etc. I suspect it is more to do with my understanding of the R functions, and how to use the API.

Oh I had a bear of a time in trying to authenticate, outside of Active Directory. I could not get this to work for my specific problem, most likely due to restrictions from my work, but I found I got the closest to a solution using the AzureGraph and companion apps:
Not sure if you have used these already. The only other thing is to note is make sure you have your app registered on the azure portal with the appropriate permissions, etc.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.