Hello ,
For context, this is the second of two posts for trying to figure out if it’s possible to make a plugin that can upload Roblox place files to GitHub through a plugin. (The first one is here)
As stated above, I’m trying to find a way to provide authentication to use GitHub’s API. Their example uses the curl
command, but I’m attempting to use HTTPService:PostAsync
. Here’s what it looks like:
curl -i -H "Authorization: token ghp_16C7e42F292c6912E7710c838347Ae178B4a" \
-d '{ \
"name": "blog", \
"auto_init": true, \
"private": true, \
"gitignore_template": "nanoc" \
}' \
https://api.github.com/user/repos
(To find this code, go here and Ctrl-F for “POST”)
My code looks like this:
--Services
local HTTPService = game:GetService("HttpService")
HTTPService:PostAsync("https://api.github.com/users/CheeseGodRoblox",
{
["Name"] = "blog";
},nil,nil,
{
["Authorization"] = "(authorization token (confidential))"
}
)
I’m getting HTTP 401 (Unauthorized)
I thought where I put the authorization is in the headers
section of the POST, since a quote from what the -H flag does for the curl command does from a linux man page says Extra header to include in the request when sending HTTP to a server.
Where would I put my authentication to correctly use this command?
Also, I’m sort of new to networking stuff like this, so please assume I don’t know what you’re talking about
Thanks,
Lord of Cheese