#Secrets

1 messages · Page 1 of 1 (latest)

broken fiber
#

I am trying to use secrets for an API im using but it doesnt seem to want to work. I have a testing script and i set the key to local key = tostring(HttpService:GetSecret("databaseAPI")) but it results in an error. replacing tostring(HttpService:GetSecret("databaseAPI")) with an actual api key works. The api key is the exact same one that is stored in the secret

#
local HttpService = game:GetService("HttpService")
local key = tostring(HttpService:GetSecret("databaseAPI"))

local success, response = pcall(function()
    return HttpService:RequestAsync({
        Url = "URL-HIDDEN",
        Method = "GET",
        Headers = {
            ["apikey"] = key,
            ["Authorization"] = "Bearer " .. key,
            ["Accept"] = "application/json"
        }
    })
end)

if success and response.Success then
    print("✅ key is valid and accepted.")
else
    warn("❌ STILL invalid key:", response.StatusCode, response.Body)
end
#

this is the testing script. not sure why using tostring(HttpService:GetSecret("databaseAPI")) results in it not working even though pasting the key directly inside the script works