Problem
The package httr
provides CURL wrappers in R (see package documentation).
I'm brand new to HTTP and APIs. My trouble is getting oauth2.0 authentication to work. I have tried various syntax and get either errors or status 401.
What is the correct way to use an oauth2.0 token and make a GET()
request using httr
?
Code Attempts
# Set UP
url = "https://canvas.{institution}.edu/api/v1/courses"
key = "{secret_key}"
# 1
GET(url, sign_oauth2.0(key))
# Error: Deprecated: supply token object to config directly
# 2
GET(url, config(sign_oauth2.0 = key))
# unknown option: sign_oauth2.0
# 3
GET(url, config = list(sign_oauth2.0 = key))
# Status 401
sep = " "
in option 1. – Kowalczyk