SAP Cloud Platform Open Connectors

Basic Auth: How do I verify credentials prior to authenticating an instance?

When building a connector that utilizes basic authentication, there are two common approaches to verifying that the user credentials are correct.  Note that by default, authenticating a connector instance using basic authentication does not verify the user credentials with the provider.

Common Approaches to Basic Authentication

  1. Authenticate a connector instance, and then make a subsequent API call to the connector to confirm it returns a 200 status code.  With this approach, the instance will need to be deleted if the API call does not return success.
  2. Abstract approach #1 into the connector.  The benefits of this approach are that you avoid making the additional call from your backend to SAP Cloud Platform Open Connectors to verify the user credentials. Instead you simply make the call to create the instance, and handle success or failure cases.  Details below.

 The Abstract Approach

We recommend adding a new resource that will make a ‘test’ call to the instance during provisioning.  If the call is successful, the credentials are valid and the instance will be provisioned.  If the call is unsuccessful, an error will be returned.

  1. From the connector configuration, click Resources.
  2. Add a new resource called "on-provision".
  3. Map the new resource to any GET all endpoint.
  4. Select On Provision from the resource type list.