Search code examples
c#amazon-web-services.net-core

AWS Marketplace Integration - .NET Core AmazonAWSMarketplaceMeteringClient - ResolveCustomer not authorized


I am having an issue resolving the customer using the registration token provided on post redirect. When I attempt to resolve the customer, I get an exception saying the user is not authorized.

"Amazon.AWSMarketplaceMetering.AmazonAWSMarketplaceMeteringException: 'User is not authorized to call ResolveCustomer for this product.'"

I build the client like this:

 marketplaceClient =
                     new AmazonAWSMarketplaceMeteringClient(awsCredentials, regionEndpoint);

and the AWS policy for the user I used to build the client is the following:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "MarketplacePolicy",
            "Effect": "Allow",
            "Action": [
                "aws-marketplace:*"
            ],
            "Resource": [
                "*"
            ]
        }
    ]
}

Finally I attempt to resolve the customer like this:

var customerData = await marketplaceClient.ResolveCustomerAsync(resolveCustRequest).ConfigureAwait(true);

Here is a screen cap of the VS exception:

Visual Studio Exception

Any and all help/ideas as to why this isn't working would be appreciated.


Solution

  • I figured out the issue.

    The API needs to called from the seller account id used to publish the SaaS application to successfully resolve the token.

    The correct marketplace account was communicated to me and everything works as it should.