---
sourceDocument: Australia Build or modify applications
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/pt-BR/application-development

 Release :

    - australia

ft:locale :

    - pt-BR

ft:publication_title :

    - Australia Build or modify applications

ft:clusterId :

    - cadev

bundleId :

    - cadev

workflow :

    - Development, Data, and Analytics


---

# Authenticate to a ServiceNow instance using OAuth 2.0 with the ServiceNow SDK

# Authenticate to a ServiceNow instance using OAuth 2.0 with the ServiceNow SDK {#ariaid-title1}

* Versão de lançamento: Australia
* 
* Atualizado 12 de mar. de 2026
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 2 min. de leitura

Use OAuth 2.0 authentication to connect to a ServiceNow instance with the ServiceNow SDK.

## Antes de Iniciar

To use OAuth 2.0 authentication, your instance must have ServiceNow IDE (version 1.1 or later) installed or have the required XML configuration imported. By default, instances on the Australia release include ServiceNow IDE version 1.1.4 and support using OAuth 2.0 authentication with the ServiceNow SDK. For more information, see [Configure a ServiceNow instance for OAuth 2.0 authentication with the ServiceNow SDK](https://servicenow-prod.fluidtopics.net/XKrm2lcAYDrATB1yO42jcQ "Import the configuration to use OAuth 2.0 authentication with the ServiceNow SDK to an instance.").

An administrator must install the ServiceNow IDE (version 1.1 or later) on the instance or configure the instance to support using OAuth 2.0 with the ServiceNow SDK. For more information, see [Install or update the ServiceNow IDE](https://servicenow-prod.fluidtopics.net/SqgRPft2t1zRBZ82L7Vmug "Install or update the ServiceNow IDE application (sn_glider) from the ServiceNow Store.") or [Configure a ServiceNow instance for OAuth 2.0 authentication with the ServiceNow SDK](https://servicenow-prod.fluidtopics.net/XKrm2lcAYDrATB1yO42jcQ "Import the configuration to use OAuth 2.0 authentication with the ServiceNow SDK to an instance.").

The default System Administrator (admin) user must configure the instance to support using OAuth 2.0 with the ServiceNow SDK. For more information, see [Configure a ServiceNow instance for OAuth 2.0 authentication with the ServiceNow SDK](https://servicenow-prod.fluidtopics.net/XKrm2lcAYDrATB1yO42jcQ "Import the configuration to use OAuth 2.0 authentication with the ServiceNow SDK to an instance.").

Role required: admin

## Por Que e Quando Desempenhar Esta Tarefa

This procedure uses the ServiceNow SDK command-line interface (CLI). From a command-line tool, enter `now-sdk --help` to get information about the available commands and global options. To get additional information about a
command and its parameters, enter the command and `--help` or `-h`. For example, `now-sdk auth --help`. For more information about the CLI, see [ServiceNow SDK CLI](https://servicenow-prod.fluidtopics.net/PRE3GTgYc~ImvC7_7y2WzA#servicenow-sdk-cli-commands "Use the ServiceNow SDK command-line interface (CLI) to manage changes between a local application and the application on an instance.").

## Procedimento

1. Open a command-line tool on your system. {#authenticate-instance-oauth__open-cmd}
2. Create a local directory for your application.
3. In Visual Studio Code, open the directory.
4. From the application directory, open an integrated Terminal window.
5. Open a command-line tool on your system. {#authenticate-instance-oauth__d2918e466}
6. Specify the instance to authenticate to with the `auth` command.Specify an alias and the authentication method to use with the `auth save` command.  

       npx @servicenow/sdk auth --add <instance>

       now-sdk auth save <alias> --type oauth

   To set this alias as the default alias, add the `--default` or `-d` parameter to your command.  
   For example:

       npx @servicenow/sdk auth --add https://myinstance.service-now.com

       now-sdk auth save devuser1 --type oauth --default true

   Nota:  
   Using the `npx` command installs the ServiceNow SDK in your application directory instead of globally.
7. Respond to the following series of prompts.  
   {#authenticate-instance-oauth__table_ivh_lzn_pdc__entry__2}

   | Prompt | Response |
   |-|-|
   | Type of authentication to use | Select oauth. |
   | Alias for these credentials | Enter an alias for your credentials and the instance. The alias can be used for authentication with the `init`, `transform`, `dependencies`, and `install` commands. |
   [ ]

   {#authenticate-instance-oauth__table_ivh_lzn_pdc}  
   The ServiceNow SDK opens a web browser to authenticate with the instance.
8. At the prompt, enter the target instance URL.  
   The ServiceNow SDK opens a web browser to authenticate with instance.
9. Navigate to the web page that opens and log in to the instance if you aren't currently logged in.
10. Select Accept to allow the ServiceNow SDK to connect to the instance.  
    The page refreshes and includes an authentication code.
11. Select Copy to copy the authentication code provided.
12. In the command line, paste the authentication code.

## Resultado

The alias and credentials are stored in the device keychain or credential manager on your system and are set as the default credentials.

## O que Fazer Depois

Add an application to your local system with the ServiceNow SDK. For more information, see [Adding applications with the ServiceNow SDK](https://servicenow-prod.fluidtopics.net/oY6_6ESXjujwGkOwEXUj_w "Add applications to your local system to get started with development in source code with the ServiceNow SDK.").

