Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Base URL not picked and resulting into golang http panic #80

Open
fruganyumisa opened this issue Dec 10, 2023 · 0 comments
Open

Base URL not picked and resulting into golang http panic #80

fruganyumisa opened this issue Dec 10, 2023 · 0 comments

Comments

@fruganyumisa
Copy link

fruganyumisa commented Dec 10, 2023

What happened?

I am trying to use the client for a getting all scans as I configured the client and added necessary envs when I try to trigger GetAllScans

What did you want to happen?

Return all scans

My implimentation is as below

func ScansHandler(w http.ResponseWriter, r *http.Request) {

client := tenablesc.NewClient(
	os.Getenv("TENABLE_URL"),
).SetAPIKey(
	os.Getenv("TENABLE_ACCESS_KEY"),
	os.Getenv("TENABLE_SECRET_KEY"),
)

_, err := client.GetCurrentUser()
if err != nil {
	exception := fmt.Errorf("Unable to authenticate to tenable some error occured : %w", err)
	fmt.Println(exception)
	os.Exit(1)

}

scans, err := client.GetAllScans()
if err != nil {
	log.Fatal(err)
}

for _, scan := range scans {

	log.Print(scan.Name)
}

}

this is what I get

go run main.go
Server Listening on port :8080
Unable to authenticate to tenable some error occured : failed to get current user: failed to make request: Get "/currentUser?fields=authType%2Cdescription%2Cgroup%2Cid%2Cname%2CorgName%2Corganization%2Crole%2Cstatus%2Cusername": unsupported protocol scheme ""
exit status 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant