Unauthorized error in Delivery API with server to server access

Hi all,

I’ve been trying to configure server to server access in a new local instance of umbraco, and I’m getting a 401 error when fetching the data. I followed the documentation, but I’ll explain exactly what I did in case I’m missing something:

  1. Create a new Umbraco project with the dotnet new umbraco -n MyProject -da command

  2. Set up the project with SQLite

  3. Create a new member

  4. Add the proper data to appsettings

    “DeliveryApi”: {
    “Enabled”: true,
    “MemberAuthorization”: {
    “ClientCredentialsFlow”: {
    “Enabled”: true,
    “AssociatedMembers”: [
    {
    “ClientId”: “client-id”,
    “ClientSecret”: “client-secret”,
    “UserName”: “apimember”
    }
    ]
    }
    }
    }

  5. Restart the service

  6. Check that the Member is now API Member

  7. Implement the example code in the previously mentioned documentation. As a note, took care that the clientid is correctly set when requesting the token ($“umbraco-member-{clientId}”)

  8. Execute the consumer.ExecuteAsync(); method as stated in the documentation.

At this point the token is correct, I checked with both debugging the app and with Bruno, but once the delivery api endpoint is called I’m getting the 401 error.

Am I missing something? Or maybe there’s something else I need to do?

Thanks a lot for your time!


This is a companion discussion topic for the original entry at https://our.umbraco.com/forum/115122-unauthorized-error-in-delivery-api-with-server-to-server-access