SAP Knowledge Base Article - Public

3753399 - Logging into Datasphere via CLI fails with the error "Did not receive a code within 30 seconds"

Symptom

  • When logging into SAP Datasphere via CLI using an OAuth client (Interactive Usage), the Command Prompt returns the following errors: 
    Did not receive a code within 30 seconds. Did you maintain the redirect URI for the OAuth client as http://localhost:8080 in SAP Datasphere? 
    Failed to log in to your account using interactive OAuth authentication
  • If setting the log level to 6 with the following command:
    set LOG_LEVEL=6
    datasphere login [options]

    The following information can be found in the log file: 
    Failed to open browser browser Error: <Browser name> is not supported as a default browser

Environment

SAP Datasphere

Reproducing the Issue

  1. Log into SAP Datasphere with CLI by entering the following command:

    datasphere login 
        --client-id "<id>" 
        --client-secret "<secret>" 
        --authorization-url "<url>"
        --token-url "<url>"
        --host "<url>" 

  2. No browser is opened, and the Command Prompt returns the time-out error. 

Cause

If no browser is specified in the login command, the system’s default web browser will be used. If the default browser is not one of the supported types listed in the online document Log into the Command Line Interface via an OAuth Client, it will prevents the CLI from completing the interactive OAuth authorization, causing it to time out while waiting for the authorization code callback.

Resolution

  • Explicitly specify a supported browser (chrome, edge, firefox, brave, or safari) using the --browser option in the login command, for example:
    datasphere login 
        --client-id "<id>" 
        --client-secret "<secret>" 
        --authorization-url "<url>"
        --token-url "<url>"
        --host "<url>"
        --browser edge

    Make sure the specified browser is installed on your system. 

  • Change the system’s default web browser to a supported one.

    Keywords

    datasphere cli, oauth login, interactive oauth, redirect uri https://localhost:8080, browser not recognized, login timeout, authorization code flow, cache error, cli authentication , KBA , DS-API-CLI , SAP Datasphere Command-Line Interface , DS-SEC-AUTZ , Authorizations (Locks, etc.) , Problem

    Product

    SAP Datasphere all versions