I have to provied an API to receive webhook notifications from business central. To give this some kind of protection I would like to use basic auth on it.
Is there a way to make BC365 use basic auth when sending notifications? I tried to include the credentials into the registered url like this, but that doesn't seem to work as expected.
{
"notificationUrl": "https://user:pwd@url/items",
"resource": "/api/v2.0/companies(xyz)/items",
"clientState": "myState"
}
Any other ideas, how have this endpoint not completely open to public exploration...?
The URL in
notificationUrlneeds to be open access.Apart from the mandatory handshake when registering your subscriber the only extra security available is to include a
clientStatein the registration.This
clientStatewill then be included in all the notifications sent to yournotificationUrland you can use that to validate if the request comes from your subscription and not somewhere else.I suggest you use a value for
clientStatethat resembles aclientSecretfor OAuth2 authentication.For more information check you the documentation for working with webhooks.