question

Rahul avatar image
Rahul asked

getting AUTH_TOKEN_VERIFICATION_FAILURE: null: null amazon in app purchase fire stick tv


I am trying to implement amazon's in app purchase(IAP) in my application. I followed the below article to implement it. https://developer.amazon.com/docs/in-app-purchasing/iap-implement-iap.html

But I am receiving below error when I am calling PurchasingService.purchase(MySku.MY_MAGAZINE_SUBS.getSku());

    com.amazon.a.a.n.a.a.a: AUTH_TOKEN_VERIFICATION_FAILURE: null: null        at com.amazon.a.a.n.a.b.a(AuthenticationTokenVerifier.java:94)        at com.amazon.a.a.n.a.a.a(AbstractCommandTask.java:204)        at com.amazon.a.a.n.a.a.a(AbstractCommandTask.java:131)        at com.amazon.a.a.n.b.b$1.run(SimpleTaskPipeline.java:179)        at android.os.Handler.handleCallback(Handler.java:873)        at android.os.Handler.dispatchMessage(Handler.java:99)        at android.os.Looper.loop(Looper.java:193)        at android.os.HandlerThread.run(HandlerThread.java:65)

MySku.java

public enum MySku {     //The only subscription product used in this sample app    MY_MAGAZINE_SUBS("com.subscription.annually", "US");     private final String sku;    private final String availableMarkpetplace;     /**     * Returns the Sku string of the MySku object     *     * @return     */    public String getSku() {        return this.sku;    }     /**     * Returns the Available Marketplace of the MySku object     *     * @return     */    public String getAvailableMarketplace() {        return this.availableMarkpetplace;    }     private MySku(final String sku, final String availableMarkpetplace) {        this.sku = sku;        this.availableMarkpetplace = availableMarkpetplace;    }     /**     * Returns the MySku object from the specified Sku and marketplace value.     *     * @param sku     * @param marketplace     * @return     */    public static MySku fromSku(final String sku, final String marketplace) {        if (MY_MAGAZINE_SUBS.getSku().equals(sku) && (null == marketplace || MY_MAGAZINE_SUBS.getAvailableMarketplace()                .equals(marketplace))) {            return MY_MAGAZINE_SUBS;        }        return null;    } 
}

Please help!!!

iapfire tvamazon pay
1 comment
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Andrei Viarshadau avatar image Andrei Viarshadau commented ·

I am having the same issue! running in production mode nothing is working for me. All requests (userData, getPurchaseUpdates and other) return RequestStatus = FAILED and I see exactly the same issue in my logs: com.amazon.a.a.n.a.a.a: AUTH_TOKEN_VERIFICATION_FAILURE: null: null

1 Like 1 ·
Levon@Amazon avatar image
Levon@Amazon answered

Hi there,

AUTH_TOKEN_VERIFICATION_FAILURE generally happens when Appstore SDK is not able to verify the Authentication token sent from Amazon servers. This generally happens when Public key (PEM file) is not available in the App. Kindly follow the steps mentioned in https://developer.amazon.com/docs/in-app-purchasing/integrate-appstore-sdk.html#configure_key to configure the key. Thanks!

2 comments
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Andrei Viarshadau avatar image Andrei Viarshadau commented ·

I have configured the key according the guide. If you don't do that you'll get different error:

D/Kiwi: AbstractCommandTask: Exception occurred while processing task: com.amazon.a.a.o.b.a.a: DATA_AUTH_KEY_LOAD_FAILURE: CERT_NOT_FOUND: null
com.amazon.a.a.o.b.a.a: DATA_AUTH_KEY_LOAD_FAILURE: CERT_NOT_FOUND: null

You'll get this error if remove AppstoreAuthenticationKey.pem from assets folder.

0 Likes 0 ·
Pradeep avatar image Pradeep Andrei Viarshadau commented ·

@Andrei Viarshadau I'm also having the same issue. (com.amazon.a.a.n.a.a.a: AUTH_TOKEN_VERIFICATION_FAILURE: null: null.) Did you find any solution?

0 Likes 0 ·
allentown avatar image
allentown answered

Did you solve it?I also encountered the same problem

1 comment
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Andrei Viarshadau avatar image Andrei Viarshadau commented ·

No, still not resolved. Currently I've postponed the update to new sdk.

0 Likes 0 ·
Andrei Viarshadau avatar image
Andrei Viarshadau answered

So, after lots of investigation I finally made it working!

Here what you need to know, to make Production mode working:

1) It only works in Life App Testing! So Production mode will work only for apk that was downloaded from the store during LAT.

2) Make sure, that your AppstoreAuthenticationKey.pem is up to date. I my case for some reason it has changed after I initially downloaded it.

3) Follow other documentation guides.


As for @Rahul original question - I think you are trying to test in Production mode locally with you debug build. It will not work! You should test locally in Sandbox mode using App Tester User Guide

10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Justin Rogness avatar image
Justin Rogness answered

Doing the sandbox testing was fairly easy. However to do test real money purchases, the app HAS to come from the Amazon App Store. Turning off sandbox mode alone does not work with local testing. Include the .pem file in the /assets directory, deploy a Live Test App, download it to your device, and only then you will get prompts to buy your in app purchases with real money.

10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Andrew C. Chud avatar image
Andrew C. Chud answered

In debug sandbox testing (on a Fire TV Cube device), I was able to get things working, even though the seemingly benign "AUTH_TOKEN_VERIFICATION_FAILURE" error still shows in the logs, by doing the following...

  1. Uninstall the app being tested from the device.
  2. Uninstall the "Amazon App Tester" app from the device.
  3. Deliver the "Amazon App Tester" app to the device, again, using the Amazon Mobile Shopping App or Amazon.com website.
  4. Launch the "Amazon App Tester" app.
  5. Set all "IAP API Response Settings" responses to all be "SUCCESS".
  6. Confirm the IAP JSON file is set up by clicking on "IAP Items in JSON File" and then scrolling down to see the items.
  7. Via ADB, flip sandbox mode to "none" and then back to "debug"...
    ```
    % adb -s 192.168.4.237:5555 shell setprop debug.amazon.sandboxmode none
    % adb -s 192.168.4.237:5555 shell setprop debug.amazon.sandboxmode debug
    ```
  8. Install the debug app being tested from Android Studio.
  9. Voila, the "AUTH_TOKEN_VERIFICATION_FAILURE" still shows up in the logs, but the API calls are now getting valid responses.

Some of these steps may be unnecessary, but this sequence worked for me, with the latest 3+ version of the SDK via Maven Central and public key included in the app, from the Amazon developer console.

10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.