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
- 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.
- 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.
- From the connector configuration, click Resources.
- Add a new resource called "on-provision".
- Map the new resource to any GET all endpoint.
- Select On Provision from the resource type list.