Prepare a ServiceNow identifier
01In brief #sec_563ebc7f
REVIEWIT collects a ServiceNow instance via an OAuth client that you register in the instance, in client credentials mode. This client acts on behalf of a service account that you create for it, and this account receives only read permissions. You entrust REVIEWIT with three values: the instance hostname, the Client ID, and the OAuth client secret.
ServiceNow does not have scopes: what REVIEWIT can read are the tables that your ACLs open to the service account. REVIEWIT reads ten tables, all in read mode, via the Table API. Each call it is entitled to make is written in the resource contract, and nothing else is sent.
Prerequisites: an instance running Washington DC or newer (client credentials mode does not exist before this), and an administrator who can assume the security_admin role to create ACLs.
021. Enable client credentials mode #sec_0a07fa2b
The mode is disabled by default in every instance.
- System Properties (type sys_properties.list in the instance browser);
- look for glide.oauth.inbound.client.credential.grant_type.enabled. It does not exist in a new instance: create it (New), type true | false;
- value true.
Without it, ServiceNow rejects the token request with unsupported_grant_type.
032. Create the service account #sec_ac894809
User Administration › Users › New:
| Field | Value |
|---|---|
| User ID | e.g., svc_reviewit |
| First name / Last name | e.g., REVIEWIT / Reader |
| Web service access only | checked: the account cannot log in to the interface |
| Active | checked |
Do not give it any useful password: it acts only through the OAuth client token.
043. Create the read role and its ACLs #sec_22038682
- User Administration › Roles › New: name reviewit_reader, description Read tables collected by REVIEWIT.
- Assume the security_admin role (user menu › Elevate role).
- System Security › Access Control (ACL) › New, for each of the ten tables below, two ACLs:
- type record, operation read, name <table> and field -- None -- (the row);
- type record, operation read, name <table> and field \ * (the columns);
- in both, Requires role: reviewit_reader, with no condition or script.
| Table | What it opens to REVIEWIT |
|---|---|
| sys_user | Accounts, service accounts, last login |
| sys_user_group | Groups, their type and their manager |
| sys_user_grmember | Group members |
| sys_user_has_role | Roles assigned to people |
| sys_group_has_role | Roles granted by groups |
| sys_user_role | Role definitions (privileged, elevation) |
| sys_user_role_contains | Roles contained in other roles |
| license_role | License-bound roles (if the instance has the plugin) |
| oauth_entity | Registered OAuth clients (never their secrets) |
| sys_user_delegate | Delegations between people |
- Add three read ACLs, also reserved for reviewit_reader, for two fields that ServiceNow protects separately:
| ACL (type record, operation read) | What it opens to REVIEWIT |
|---|---|
| sys_package and sys_package.* | The package of each role: this is what distinguishes roles created by you from native roles. Without these, the resource "client-created roles" remains empty. |
| oauth_entity.active | The active or inactive status of each OAuth client. Without it, this status remains unknown. |
- Grant the service account the roles reviewit_reader, role_viewer, usage_admin, and snc_read_only.
Two tables have native "Deny Unless" ACLs that your read ACLs do not override:
| Table | What it opens |
|---|---|
| sys_user_role | The native role role_viewer. Without it, the table returns empty: the account only sees the roles it would be allowed to assign. |
| license_role | The native role usage_admin (it contains sn_sub_man.admin). Without it, the table is denied and the license resource cannot be collected. |
snc_read_only prevents any writing by the account, regardless of its other roles: usage_admin and role_viewer only serve to read. Never give it admin: this role bypasses ACLs and can modify everything. If the account has admin or lacks snc_read_only, REVIEWIT accepts the connection but displays a warning on the identifier.
A table you do not open does not block the connection: resources that depend on it remain uncollectable, and the Prepare step of the wizard names them.
054. Register the OAuth client #sec_5d7bcc81
Depending on your version :
- Brazil : System OAuth › Inbound Integrations , which opens the Machine Identity Console › New integration › OAuth - Client credentials grant ;
- Zurich to Australia : System OAuth › Inbound Integrations › New Integration › OAuth - Client credentials grant ;
- Washington DC to Yokohama : System OAuth › Application Registry › New › Create an OAuth API endpoint for external clients .
Set up the client :
| Field | Value |
|---|---|
| Name | for example REVIEWIT Collector |
| Provider name | for example REVIEWIT |
| OAuth application user | the service account from section 2 (look it up by its display name, REVIEWIT Reader ) |
| Active | checked |
From Zurich, the client requires an authorization scope ( Auth scope ), and the option Allow access only to APIs in selected scope is checked by default. Do not use useraccount , which opens all APIs to the account: Create auth scope , name reviewit_read , then in Limit authorization to the following APIs , choose Table API only. REVIEWIT only calls the Table API.
Save : ServiceNow generates the Client ID and the Client Secret . Tokens last 30 minutes.
065. Retrieve the three values #sec_16c316c6
| Value | Where to find it |
|---|---|
| Instance | The host name alone, without https:// : acme.service-now.com (or ….servicenowservices.com for a government instance) |
| Client ID | The OAuth client record |
| Client secret | Same record (lock icon to display it) |
A custom domain ( itsm.your-company.com ) is not accepted: enter the native instance address, which always exists.
In REVIEWIT : Connections › New connection › ServiceNow , enter the three values. The verification :
- gets a token from the entered instance ;
- reads the service account in the instance directory ;
- reads its roles and warns if it might write.
Then the rights proof reads each of the ten tables. A table that cannot be empty (accounts, roles) and which returns empty is reported as filtered read: an older ACL, with a condition, hides part of the rows. Check the ACLs of that table then.
076. If the connection is refused #sec_c2e25297
| Message | Cause | Action |
|---|---|---|
| unsupported_grant_type | The property in section 1 is not true | Section 1 |
| access_denied / server_error , or invalid_client | Wrong Client ID or secret, inactive OAuth client, or client without application user | Re-copy the values from the client record, check section 4 |
| A table « filtered read » | A « Deny Unless » ACL hides its rows ( sys_user_role without role_viewer ) | Section 3 |
| 401 on the API | The service account is inactive | Section 2 |
| 403 on the API | The service account cannot read sys_user | Section 3 |
| instance may be hibernating | Development instance asleep, or address that is not an instance | Wake the instance, verify the address |
| The ServiceNow instance must be the bare host… | Address with https:// , a path, or a custom domain | Section 5 |
The secret only changes if you regenerate it: do so whenever someone who has seen it leaves, then replace it in REVIEWIT.