Reputation: 51
The code is below and every time I try to run this code I get the same error. How do I solve this?
import http.client
conn = http.client.HTTPSConnection("")
headers = { 'authorization': "Bearer YOUR_ACCESS_TOKEN" }
conn.request("GET", "/violetwears.auth0.com/api/v2/users/USER_ID", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Upvotes: 1
Views: 567
Reputation: 2185
I was struggling with this issue for a while now but it finally worked when I passed the domain to the HTTPSConnection constructor and remove it from the request url as follows. Credit to the answer here on auth0 community
import http.client
conn = http.client.HTTPSConnection("violetwears.auth0.com")
headers = { 'authorization': "Bearer YOUR_ACCESS_TOKEN" }
conn.request("GET", "/api/v2/users/USER_ID", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Upvotes: 2