Extend: Sdk.Platform.Fulfillment.FulfillItem insufficient permission

We’re getting an error when attempting to fulfill an item via an extend service extension:

{“{"errorCode":20013,"errorMessage":"insufficient permission","devStackTrace":"require permission: Permission(resource=ADMIN:NAMESPACE:{namespace}:USER:{userId}:FULFILLMENT, action=1)"}”}

Here is the IAM client associated with the Extend service extension:

…I added any and all permissions I could think of having to do with entitlements or fulfillment. Also note that we’re using FulfillItem as that is what was recommended when we asked how to go about granting a durable entitlement.

For completeness, here’s the code as it is currently written (using C# SDK):

var grantEntitlementBody = new FulfillmentRequest();
grantEntitlementBody.ItemSku = durableItemSku;
grantEntitlementBody.Quantity = 1;
var grantEntitlementOpBuilder = _ABProvider.Sdk.Platform.Fulfillment.FulfillItemOp;
grantEntitlementOpBuilder.SetBody(grantEntitlementBody);
var grantEntitlementOp = grantEntitlementOpBuilder.Build(NAMESPACE, userId);
var grantEntitlementResponse = _ABProvider.Sdk.Platform.Fulfillment.FulfillItem(grantEntitlementOp);

Thanks!

hi @njupshot

The issue because your Extend App still use the old token that haven’t contains the Fulfillment permission, our default token expiration is 1 hour. You add the Fulfillment permission after your Extend App running.

If you restart your Extend App, it should use the new token now.
Or simply wait until 1 hour, and Extend SDK will refresh the token automatically.

Let us know if you still face this insufficient permission issue.

Regards,
Marsel

1 Like