Skip to main content
Version: v2.0

Client credentials

The Client Credentials flow works for server‑to‑server integrations where no user participates. The SDK authenticates using a client ID and client secret, and ServiceNow issues an access token representing the application itself.

Objective​

Configure and use the Client Credentials OAuth flow 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
Client IDFrom a ServiceNow OAuth application registry entry
Client SecretFrom the same registry entry

SDK flow​

Initialize the SDK​

cred, err := credentials.NewClientCredentialsProvider(
"{clientID}",
"{clientSecret}",
credentials.WithInstance("{instance}"),
)
if err != nil {
log.Fatal(err)
}

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?