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"
            }
         ]
      }
   }
}
  1. Restart the service
  2. Check that the Member is now API Member
  3. 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}")
  4. 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!

1 Like

Hi @jcrmerlin

How are you fetching the data?

Can you fetch the delivery api via swagger without any issues`?

1 Like

Hi @Amalie-Wowern,
Sorry for the late reply! So this was a POC I was doing a few months back and today I tried again to check on your comment and… It just worked. No idea why, maybe there’s something missing on my tests.
Anyway, as it’s not a priority for me for now let’s mark it as solved. If someone else claims it’s happenning to them we can take a look again.
Thanks!

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.