in-app billing android return authentication is required when try to subscribe to product

Solution 1:

I have the same issue previously. Go to your google developer console and make sure your app is PUBLISHED to any version(alpha, beta or prod). Then, the In app purchase will work :)

Solution 2:

Got same problem with dreadful message:

Authentication is required. You need to sign in to your Google Account.

There were two problems for me:

  1. I tried to buy a product in my code with identifier "com.argonnetech.wordswriting.noads" but the in app product configured in Google Play Developer (GPD) console was named simply "noads"
  2. After changing the name of the in app product in GPD console, I had to switch it to "Active" mode

The it worked. The error message is misleading, an error like "in app item doesn't exist would be better".

Solution 3:

Android Developer testing for in-app purchase account should following this keys.

Base64EncodedPublicKey

// Testing base64EncodedPublicKey

public static final String base64EncodedPublicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCg" +
 "KCAQEAhNe2XQ70DceAwE6uyYJGK1dIBbZcPdlER/9EEzylr6RDU6tnGj0Tk7kceN03GKvRf/ucT+ERLL3O" +
 "aHR22PXRXLZ17NZ81x6oS2vGmLyXBnjrU/I+asl8cNuLGySaoCdXxPAV+A9g6OG13dk+KY9i0O1roGpFH" +
 "fsAFyKCgSqR0PMJZ1bS+wFFBYf3M4IxgBcxuuZKDmR+MztCgm5N4zc6w2CwFZn3mXeDoTg15mWDU3sZO" +
 "WeRwFeynhV+FCYdDp8DpAkLk1b5IiXYFQ53wxCh/GxiKqBB6uQMmAixFjAcZV1QWfcBABae9vxiV5" +
 "VAEJvOOnhPxnaT9HYadW0pQ/UbJwIDAQAB";

And item purchased key like that

ITEM_PURCHASED

// Testing ITEM_PURCHASED

public static final String ITEM_PURCHASED = "android.test.purchased";

And Starting put this code onCreate() to initialization IabHelper class for in-app purchase,

IabHelper helper = new IabHelper(this, Constants.base64EncodedPublicKey);
helper.startSetup(new IabHelper.OnIabSetupFinishedListener() {
        public void onIabSetupFinished(IabResult result) {
            if (!result.isSuccess()) {
                Log.d("#InAppStartSetup#", "In-app Billing setup failed: " + result);
            } else {
                Log.d("#InAppStartSetup#", "In-app Billing setup successful.");
            }
        }
    });

And finally purchased time on this code handle over here,

helper.launchPurchaseFlow(YOUR_ACTIVITY, Constants.ITEM_PURCHASED,
                YOUR_REQUEST_CODE, mPurchaseFinishedListener, "");

Thank You Guys...