ServiceNow OAuth Setup
Verbind Snow-Flow met je ServiceNow instance via OAuth 2.0. Deze handleiding leidt je door het maken van een OAuth applicatie en veilige authenticatie.
Vereisten
ServiceNow Instance
Toegang tot een ServiceNow instance met admin rechten
Snow-Flow Geïnstalleerd
Snow-Flow CLI geïnstalleerd via npm
OAuth Plugin Actief
System OAuth plugin ingeschakeld in ServiceNow
Maak OAuth Applicatie in ServiceNow
- Navigeer naar System OAuth > Application Registry in je ServiceNow instance
- Klik op New en selecteer "Create an OAuth API endpoint for external clients"
- Vul de applicatie details in:
Name Snow-Flow MCP Beschrijvende naam voor de applicatie Client ID (automatisch gegenereerd) Kopieer deze waarde na opslaan Client Secret (automatisch gegenereerd) Kopieer deze waarde na opslaan Redirect URL http://localhost:3005/callback Vereist voor OAuth flow Active Aangevinkt Kopieer OAuth Credentials
- Na het opslaan van de applicatie, kopieer de volgende waarden:
abc123def456ghi789jkl012mno345pq xyz987wvu654tsr321qpo098nml765kj https://dev12345.service-now.com Authenticeer in Snow-Flow
Start Snow-Flow en gebruik het /auth commando:
# Start Snow-Flow snow-flow # In the TUI, type: /auth # Follow the prompts: # 1. Enter your ServiceNow instance URL # 2. Enter the Client ID # 3. Enter the Client Secret # 4. A browser window opens for OAuth consent # 5. Authorize the application in ServiceNow # 6. You'll be redirected back automatically
Remote Omgevingen
# Same first 3 steps (instance, client ID, secret), then: # 4. Snow-Flow shows an OAuth URL # 5. Open the URL in your local browser # 6. Authorize the application in ServiceNow # 7. Your browser redirects to localhost (page may show an error) # 8. Copy the FULL URL from your browser address bar # 9. Paste the URL into Snow-Flow and press Enter
~/.local/share/snow-code/auth.json Verifieer Verbinding
Na authenticatie, verifieer dat de verbinding werkt:
# Check authentication status /auth list # Or ask the AI to query something > Show me the latest 5 incidents # If successful, you'll see real data from your instance!
Alternatieve Configuratie Methoden
Omgevingsvariabelen
Stel credentials in als omgevingsvariabelen voor CI/CD of server deployments:
export SERVICENOW_INSTANCE_URL="https://dev12345.service-now.com" export SERVICENOW_CLIENT_ID="your-client-id" export SERVICENOW_CLIENT_SECRET="your-client-secret"
.env Bestand
Sla credentials op in een .env bestand in je project map:
# .env SERVICENOW_INSTANCE_URL=https://dev12345.service-now.com SERVICENOW_CLIENT_ID=your-client-id SERVICENOW_CLIENT_SECRET=your-client-secret
Direct Login Commando
Geef de instance URL direct mee aan het auth commando:
snow-flow auth login https://dev12345.service-now.com
Probleemoplossing
OAuth Error: Invalid Client
Controleer je Client ID en Client Secret. Zorg dat er geen extra spaties zijn.
Redirect URI Mismatch
Zorg dat de Redirect URL in ServiceNow exact is: http://localhost:3005/callback
Poort 3005 Al in Gebruik
Sluit andere applicaties die poort 3005 gebruiken, of controleer op vastgelopen Snow-Flow processen.
Token Verlopen
Tokens worden automatisch vernieuwd. Bij aanhoudende problemen, voer /auth opnieuw uit om te herauthenticeren.
Remote/Headless Authenticatie
In GitHub Codespaces of SSH sessies toont Snow-Flow een URL om te kopiëren in plaats van een browser te openen. Na het autoriseren, kopieer de volledige callback URL (inclusief ?code=...) uit de adresbalk van je browser en plak deze terug in Snow-Flow.
Klaar om te Bouwen?
Je bent helemaal klaar! Verken de MCP tools of leer meer over de TUI.