I’m trying to update a github file using httpservice.
Github has two authorization parameters: Username, and Token.
Whenever I try to specify these in a header I get the error:
Header "auth" must have its value be a string!
The headers part of my code:
Headers = {
["auth"] = {"Username",key},
["Content-Type"] = "application/json",
},
GABA8
(nexpid)
June 3, 2023, 12:00pm
#2
As far as I know, GitHub uses an Authorization
header with the user’s token, like this:
Headers = {
["authorization"] = "Bearer " .. key,
["content-type"] = "application/json"
}
But, if you need to use the auth
header, you must first turn it into a JSON string, like this:
Headers = {
["auth"] = HttpService:JSONEncode({"Username", key}),
["content-type"] = "application/json"
}