Xero api connection

I’ve been over and over the docs and posts and I’m obviously missing something.
Can anyone explain or point me to a clear example of how I can connect to the xero api using my client_id and secret and NOT requiring a click to authorise the connection ?

I’m trying to automatically generate invoices and send them to bookings on a public site and I can’t see how the redirect and manual authorisation could work in this scenario.

I’m using the xero-php-oauth2 library but all examples seem to require a user to manually authorize access or they assume a token exists as per in the documentation example below.
I have found information on creating an invoice and adding lineitems but just can’t seem to get my head around how to automate the process of connecting

What am I missing ??

require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPIXeroPHPConfiguration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPIXeroPHPApiAccountingApi(
    new GuzzleHttpClient(),
    $config
);```