> ## Documentation Index
> Fetch the complete documentation index at: https://docs.neoagent.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Creating the OAuth Application

> Register the ServiceNow OAuth application Neo Agent connects with

Neo Agent connects to ServiceNow with the OAuth 2.0 Authorization Code grant. You register a dedicated OAuth application in your own instance; Neo never sees your credentials directly.

## Creating the OAuth Application

**1. Find Application Registry**

In ServiceNow, use the navigation search (top left) to find System OAuth → Application Registry and open it.

![Searching for System OAuth, Application Registry](https://mintcdn.com/neoagent/enpQfQhg_kNStBLx/images/servicenow/sn-find-application-registry.png?fit=max\&auto=format\&n=enpQfQhg_kNStBLx\&q=85\&s=b6b3e73510f145d4231f670f760c0fac)

Search for 'system oauth' and click Application Registry in the results

**2. Create a new OAuth integration**

Click New (top right). When ServiceNow asks what kind of OAuth application, choose **New Inbound Integration Experience** (the first option). On the Inbound Integrations page, click New integration.

![Application Registry list page](https://mintcdn.com/neoagent/enpQfQhg_kNStBLx/images/servicenow/sn-new-application-registry.png?fit=max\&auto=format\&n=enpQfQhg_kNStBLx\&q=85\&s=fd1ddb96b65b65441e8e61bc4368b736)

The Application Registry list, click New to begin

![OAuth application kind selector](https://mintcdn.com/neoagent/enpQfQhg_kNStBLx/images/servicenow/sn-application-registry-new-integration-type.png?fit=max\&auto=format\&n=enpQfQhg_kNStBLx\&q=85\&s=a97719d0991a9e0345b0dbeffc4ce8f0)

Pick 'New Inbound Integration Experience'; entries marked \[Deprecated UI] still work but are flagged for removal

![Inbound Integrations list page](https://mintcdn.com/neoagent/enpQfQhg_kNStBLx/images/servicenow/sn-application-registry-new.png?fit=max\&auto=format\&n=enpQfQhg_kNStBLx\&q=85\&s=f614f3db2837c09bdc5d585b1afd4bc1)

The Inbound Integrations page, click 'New integration' (top right)

**3. Pick the OAuth grant type**

Choose **OAuth - Authorization code grant** (the first option).

![OAuth application connection type selector](https://mintcdn.com/neoagent/enpQfQhg_kNStBLx/images/servicenow/sn-select-application-type.png?fit=max\&auto=format\&n=enpQfQhg_kNStBLx\&q=85\&s=07404300c4c04d9f8ebd7a0b890f35bb)

Pick 'OAuth - Authorization code grant'

> [!NOTE]
>
> Neo uses the Authorization Code grant so every action it takes (notes, state changes, time entries) is attributed to the OAuth user in your audit logs. The other grant types either lose user attribution or require Neo to know the user's password.

**4. Configure the details and save**

Fill in the form:

**Name** `string` *required*

A clear name like `Neo Agent`. It appears in your audit logs whenever Neo authenticates.

**Redirect URL** `string` *required*

Exactly `https://dashboard.neoagent.io/oauth/servicenow/callback`. Extra trailing slashes or query parameters make the consent step fail.

**Refresh Token Lifespan** `integer`

Keep the default of `8,640,000` seconds (100 days). Shorter lifespans force more frequent reconnects.

**Access Token Lifespan** `integer`

Keep the default of `1800` seconds. Neo refreshes access tokens automatically.

Leave Active checked and save. ServiceNow generates a **Client ID** and **Client Secret**. Copy both now, together with your instance URL (for example `https://acme.service-now.com`, no trailing slash). The connect step needs all three.

![OAuth application form filled in](https://mintcdn.com/neoagent/GQlcZoUOtCEqkVy5/images/servicenow/sn-new-app-record.png?fit=max\&auto=format\&n=GQlcZoUOtCEqkVy5\&q=85\&s=2f0ccb5924043371c29680294ffc493a)

The New record form with the auto-generated Client ID and Client Secret

> [!WARNING]
>
> Copy the Client Secret as soon as it is generated. In some configurations ServiceNow re-encrypts the field after you navigate away, and you have to regenerate it.

## Create the Neo service account

The Authorization Code grant runs as a specific user, and every note, state change, time entry, and assignment is attributed to that user for the lifetime of the connection. Create a dedicated Neo Agent service account before you connect; do not reuse a personal admin account or a shared integration user.

Create the user with:

| Setting | Value |
| - | - |
| User name | `neo.agent`, display name `Neo Agent (Service Account)` |
| Role | `itil`, so it can read and update task-family records, take assignments, and post customer-visible comments |
| Table API read and write | `task` plus every subclass your agents work with: `incident`, `sc_request`, `sc_req_item`, `sc_task`, `change_request`, `problem` |
| Table API read and write | `sys_journal_field` (notes), `task_time_worked` (time entries), `sys_user`, `sys_user_group` (assignment lookups), and any custom `u_*` columns your agents set |
| Optional role | `email_api_send`, only if you plan to use Neo's "Email (sent via PSA)" notification mode |
| Account state | Active = true, email notifications off |
| Password | One you can sign in with; you log into ServiceNow as this user during the connect step |

> [!WARNING]
>
> The user who is signed in during OAuth consent becomes Neo's identity, not the user who created this OAuth app. If a different person is signed in when they click Allow, their account becomes Neo's identity. See the [connect step](https://docs.neoagent.io/integrations/psa/servicenow/connecting-to-neo.md).

## Keep Neo away from specific companies

[Excluded companies](https://docs.neoagent.io/integrations/psa/exclude-company-tickets.md) keeps a company's tickets out of Neo's sync and triggered agents. A scheduled agent or Chat Agent reads the PSA as the account Neo signs in with, so to keep those agents away from a company too, restrict that account.

Neo signs in as its service account, so a ServiceNow administrator can hide a company from that account with a **before-query business rule** on the **task** table. ServiceNow also runs a task rule for queries on the tables that extend it (incident, sc\_request, sc\_req\_item, sc\_task, change\_request, problem), so one rule covers Neo's ticket searches. The rule runs only for Neo's service account and adds `current.addEncodedQuery('company!=<sys_id>^ORcompanyISEMPTY')`, so the company's records never come back and records with no company still do.

A rule hides the company only on the tables it covers. Neo can also read related tables that do not extend task: comments and work notes, time worked, users and companies, catalog variables, interactions, CMDB records, attachments, SLAs and approvals. Add a rule to each one you need hidden; ServiceNow warns that many before-query rules can slow queries. An extra read ACL does not do this job: ServiceNow grants access when any matching ACL passes, so the ACLs Neo's role already has keep the company visible. Domain separation also works, but it changes the whole instance.

## What's Next?

Proceed to [connect ServiceNow to Neo Agent](https://docs.neoagent.io/integrations/psa/servicenow/connecting-to-neo.md).

> [!TIP]
>
> Before you proceed, verify:
>
> * The OAuth application is Active with the exact Redirect URL above
> * You saved the Client ID, the Client Secret, and your instance URL
> * The Neo Agent service account exists with the `itil` role and task-family table access
> * You know the service account's password; you sign in as it on the next page


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.