Run service "the API key does not have the current service in scope"

Hi,

I have an old service with a new endpoint i want users to be able to run from App using “Run Service”. I have set it up so the app user role has “act as service account” for the service account which has access to the respective service.

I get this error message when trying to run it

And I am wondering which API key it is referring to and how to fix it. The service has 2 active bearer tokens for external use. I have tried multiple other combinations of permissions without success, but as the “Run Service” action node has no API key, I am stumped. Please help :slight_smile:

Best regards
Sondre

Hi Sondre,

Could this refer to the API Key which is connected to your Service Account? Upon creation, these API Keys can be scoped to specific services, but this cannot be edited later. Maybe a new API Key should be generated for this Service Account, which includes this service in the scope?

Rhys

Hi Rhys,

The API key has the service in scope
image

The role has act as service account
image

And i tried creating a new API key to see if that somehow triggered a recognition of the context, but with no success.

I have a lot of Roles attached to my user and there exists 3 API keys on the service Account. Could that be something to do with it?

Or I have forgotten a detail which I imagine is more likely in this case.
Maybe it would be an idea to add Roles that can act as service account here? Like you have on object classes in the data model.

Its a bit finicky at the moment and every time i set it up I have forgotten how to next time :sweat_smile:

Sondre

Hi,

Yes, maybe a new service account with just one API key can help here. But I think it would be good to add roles to the Service Account as well. “Normal” app users need to be able to act as this service account to be able to run the service from the context of the app.

You can read more about the Run Service action node and Service Accounts in our docs.

Hi,

sorry, it was the web request inside the service endpoint that went wrong and i interpreted the error message as coming from the service. I guess the “response data” was a hint that is was the web request inside the Service. Everything works as expected!

Regards Sondre