SAP Knowledge Base Article - Public

3501733 - How to get the OAuth token for CLI command

Symptom

  • You have created an OAuth Client in Datasphere and would like to use it in the CLI command
  • You are facing issues with using the OAuth credentials in the CLI command

Environment

SAP Datasphere

Resolution

  1. Ensure that the Redirect URI is set to http://localhost:8080/ as mentioned in Create OAuth2.0 Clients to Authenticate Against SAP Datasphere ("Redirect URI")
  2. Run the command datasphere logout . This is to logout of any earlier logins which you may have done
  3. Run the command datasphere config cache clean to clear the cache
  4. Run the command datasphere config cache init --host https://<tenantname>.hanacloudservices.cloud.sap/ --authorization-url https://<tenant name>.authentication.sap.hana.ondemand.com/oauth/authorize --token-url https://<tenant name>/oauth/token --client-id "<client id>" --client-secret "<client secret>"
  5. After step 4 there will be a window open asking to login to your datasphere tenant
  6. Once you login you can close the window and then start using the command line commands. There is no need for the authorization code moving forward

See Also

Keywords

Command Line, Oauth, CLI, comand , KBA , DS-API-CLI , SAP Datasphere Command-Line Interface , How To

Product

SAP Datasphere 1.0