Skip to main content
Version: main

JWT token authentication

JWT Token authentication lets the SDK authenticate using a signed JSON Web Token (JWT). ServiceNow validates the signature using a public key configured in your instance and issues an access token. This method is ideal for secure, non‑interactive server‑to‑server integrations.

Objective

Configure and use JWT Token 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
Client IDFrom a ServiceNow OAuth or JWT registry entry
Client SecretRequired by ServiceNow for JWT Bearer flows

Your application must also provide:

  • Private key used to sign the JWT assertion
  • A token provider capable of generating signed JWT assertions

SDK flow

Initialize the SDK

cred, err := credentials.NewJWTProvider(
"{clientID}",
"{clientSecret}",
tokenProvider,
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?