ByCloud Docs
GuidesCLIAPISDK

Authentication

Configure authentication for the Go SDK.

Using an Access Token

If you have an access token from the ByCloud console, you can use it directly:

package main
import "github.com/bycoded/bycloud-go"
func main() {
// Using an access token
client := bycloud.New(bycloud.WithToken("YOUR_ACCESS_TOKEN"))
}

Using API Key Credentials

For service accounts, use the access key ID and secret access key:

package main
import "github.com/bycoded/bycloud-go"
func main() {
// Using API key credentials
client := bycloud.New(
bycloud.WithAPIKey("YOUR_ACCESS_KEY_ID", "YOUR_SECRET_ACCESS_KEY"),
)
}

Environment Variables

The SDK can automatically read credentials from environment variables. This is recommended for production deployments:

package main
import "github.com/bycoded/bycloud-go"
func main() {
// The SDK automatically reads from environment variables:
// BYCLOUD_TOKEN or BYCLOUD_ACCESS_KEY_ID + BYCLOUD_SECRET_ACCESS_KEY
client := bycloud.New()
}

Supported environment variables: BYCLOUD_TOKEN, BYCLOUD_ACCESS_KEY_ID, BYCLOUD_SECRET_ACCESS_KEY