Skip to main content
Version: v2.0

Basic authentication

Basic Authentication uses a ServiceNow username and password to authenticate API calls. it's simple to configure, but use it primarily for development, testing, or controlled system‑to‑system integrations.

Objective

Configure and use Basic Authentication with the Service‑Now SDK using values provided by your ServiceNow administrator.

Required values

Your administrator must provide:

ValueDescription
Service‑Now URLBase URL of the instance
UsernameIntegration user’s username
PasswordIntegration user’s password

SDK flow

Initialize the SDK

cred := credentials.NewBasicProvider("{username}", "{password}")

client, err := servicenowsdkgo.NewServiceNowServiceClient(
servicenowsdkgo.WithAuthenticationProvider(cred),
servicenowsdkgo.WithInstance("{instance}"),
)
if err != nil {
log.Fatal(err)
}

// Client is now authenticated and ready to use
_ = client
Was this page helpful?