Google IAP Error: Authentication is required. Huh?

I am running into this exact same issue.

My code is probably as simple as it gets.

I am wondering if this issue stems off of the basics when using static responses.

Here are 2 scenarios (One using android’s static responses, one using in-app purchase legit)

Scenario A: Static Calls using “android.test.purchased”.

  • When calling it I get the purchase screen with the fake visa number. And when it finishes, in the console it outputs

Transaction failed:  -1003   Signature verification failed for sku android.test.purchased (response: -1003:Purchase signature verification failed)

  • Then if I try again I get

Transaction failed:  7       Unable to buy item (response: 7: Item Already Owned)

Which is extremely odd to me considering it just said it failed after the UI said it didn’t fail. Oy

Scenario B:

  • Uploaded and published Release Signed Beta build to the android dev account

  • Added license key into config.lua (Quadruple checked to see if it was the right one)

  • Testing on non-dev gmail account (even removed all other accounts from my device)

  • Added google+ group with non-dev account added

  • Added in-app purchase to dev account

  • Set in-app purchase to active

  • Install app thru beta link and try to purchase with non-dev account.

Then when I run the app and try it says “Authentication is required. You need to sign into your Google Account.”

Is it maybe a release signing issue? I am unsure.  :frowning:

any help is appreciated.

Part of my config

 usesPermissions = { "android.permission.INTERNET", "com.android.vending.BILLING", "com.android.vending.CHECK\_LICENSE", },

Codez

local store = require( "plugin.google.iap.v3" ) local net = {} -------------------------------------------------------------------------------- local function transactionCallback( event ) -------------------------------------------------------------------------------- -- Processes all events that happen with the store. local transaction = event.transaction if ( transaction.state == "purchased" ) then print( "Transaction succuessful!" ) elseif ( transaction.state == "cancelled" ) then print( "User cancelled transaction." ) elseif ( transaction.state == "failed" ) then print( "Transaction failed:", transaction.errorType, transaction.errorString ) else print( "(unknown event)" ) end end store.init("google", transactionCallback ) -------------------------------------------------------------------------------- local function purchaseItem() -------------------------------------------------------------------------------- if store.isActive then store.purchase( "android.test.purchased" ) end end net.purchaseItem = purchaseItem return net

WELL, its working now! Apparently it takes time after the app is published in order for all of the services to get up. Would be nice if there was some notification of it at all. 

Woot!

Hey

Say, did anyone else who got the same “authentication required” error, go passed that problem in a non-magical way?

Because i am facing the same problem and it just wont go away.

You can change your account on the google play store, The google app itself (google Now), your email, and everwhere else and it may still fail. The only way to test in app purchases is to remove the developer account completely from your test device. I suggest getting another devices if you only own one. P.S. In-app purchasing on google is a complete nightmare

Thanks, but I knew that already. I tried many things and I manage to track the problem.

Stupidly from my side, I did not even realize I entered under the ‘In-app Products’ a short name like ‘myproduct’ and when trying to access it through the code, I called for the whole package name with that name: ‘com.mysite.myapp.myproduct’. and that made the error occur .

i has the very same problem but once i published app as alpha everything worked fine. Even with my publisher mail id i was not having any problems.

When i try to purchase with publisher mail id i was getting “Publisher cannot make purchases” and with other tester accounts i was able to make purchases.

That is how it is suppose to work. I mean when you get “authentication required…” it is not because you are connected with your publisher account.

I’m having the same problem, I tried making the purchase with every account I have and on different devices and I always get that error. Here’s the log:

I/Corona (25676): PURCHASE \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* D/Finsky (24174): [14769] InAppBillingUtils.getPreferredAccount: (myapp name): Account from first account - [ieJC9jZQt-43Mx7723-cXNCET8U] E/Parcel ( 679): Class not found when unmarshalling: com.google.android.finsky .billing.lightpurchase.PurchaseParams, e: java.lang.ClassNotFoundException: com. google.android.finsky.billing.lightpurchase.PurchaseParams I/CustomFrequencyManager( 679): newFrequencyRequest - mFrequency = 1350000, mT imeoutMs = -1, mPkgName = ACTIVITY\_RESUME\_BOOSTER@4 I/CustomFrequencyManager( 679): Boost Request from package = ACTIVITY\_RESUME\_BO OSTER@4 frequency : 1350000type = 6 I/CustomFrequencyManager( 679): !! pkgName = ACTIVITY\_RESUME\_BOOSTER@4 I/CustomFrequencyManager( 679): Request from package name pkgName = ACTIVITY\_RE SUME\_BOOSTER@4 I/CustomFrequencyManager( 679): mContext is Not Null mContext.pkgName = androi d I/CustomFrequencyManager( 679): 2 Old token will be reused! I/CustomFrequencyManager( 679): CPUDVFSControlRequest : doFrequencyRequest:: = 1350000 Timeout : -1 I/power ( 679): \*\*\* acquire\_dvfs\_lock : lockType : 1 freq : 1350000 D/qdmemalloc( 245): ion: Mapped buffer base:0x48f3f000 size:1835008 fd:75 D/CustomFrequencyManagerService( 679): acquireDVFSLockLocked : type : DVFS\_MIN\_ LIMIT frequency : 1350000 uid : 1000 pid : 679 pkgName : ACTIVITY\_RESUME\_BOO STER@4 W/ActivityManager( 679): mDVFSHelper.acquire() W/ContextImpl( 679): Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:1336 com.android.server.am.Activity Stack.startActivityUncheckedLocked:4452 com.android.server.am.ActivityStack.star tActivityLocked:3936 com.android.server.am.ActivityStack.startActivityMayWait:46 16 com.android.server.am.ActivityManagerService.startActivityInPackage:3135 D/qdmemalloc( 245): ion: Mapped buffer base:0x40057000 size:4096 fd:90 D/qdmemalloc( 245): ion: unmap\_buffer base:0x0 size:1835008 offset:0 fd:75 D/qdmemalloc( 245): ion: unmap\_buffer base:0x0 size:4096 offset:0 fd:90 E/MP-Decision( 1509): num online cores: 1 reqd : 2 available : 4 rq\_depth:1.4000 00 hotplug\_avg\_load\_dw: 72 E/MP-Decision( 1509): UP cpu:1 core\_idx:1 Nw:1.900000 Tw:140 total\_time\_up:0.000 000 D/dalvikvm( 679): GC\_FOR\_ALLOC freed 1432K, 20% free 85121K/105812K, paused 191 ms, total 191ms D/SensorManager(25676): unregisterListener:: D/Sensors (25676): Remain listener = Sending .. normal delay 200ms I/Sensors (25676): sendDelay --- 200000000 I/SensorService( 679): info.selectDelay() ns=20000000 D/SensorService( 679): SensorDevice::setDelay, Return(true 1, false 0) = 1 D/SensorManager(25676): JNI - sendDelay I/SensorManager(25676): Set normal delay = true D/SensorService( 679): SensorDevice::activating sensor handle=0 ns=20000000 W/ContextImpl( 679): Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:1336 com.android.server.am.Activity Stack.startPausingLocked:1315 com.android.server.am.ActivityStack.resumeTopActiv ityLocked:2377 com.android.server.am.ActivityStack.resumeTopActivityLocked:2163 com.android.server.am.ActivityStack.resumeTopActivityLocked:2149

Hi Jose,

Did you publish your app?, i was facing similar issue, but once i published my app (as alpha) everything worked fine.

Hey, Jose

Look it might be confusing. There are a lot of reasons why this error can happen. The log is not helpful as it may seem to many people.

Most errors shown if not all has nothing to do with your problem or your app at all.

I kind of struggled with it until I solved my problem, which was actually very simple and ediotic mistake by my part. 

What I learned that may cause this error:

1- Make sure you have published your app in beta or alpha version. don’t just upload it. press the publish button.

2- Make sure you ‘Activate’ your in-app purchases Items.

3- The names of your items in the shop must!!! match the names of your items when you call for ‘purchase’. (e.g. “com.mycompany.myapp.item_a”. that was my mistake.)

4- maybe this has nothing to do with that but make sure to publish and build under different app name than your other apps, and use a new keystore for it. (just create one with ‘keytool’, it is pretty easy).

As far as I can remember those where some of the problems I managed to look up while trying to solve mine. good luck.

thanks nischal.srinivas and thanks smithsun00 for the detailed reply.

I already have my app published for beta.

How do I activate the in-app purchase items? I already have a list of them but I can’t find where to activate, or maybe I already did.

In the code I’m calling the “purchase” item with “com.mycompany.myapp.item_a”, but I inserted my products in the console with only the name “item_a”. Is that a problem? Do I really need to give every item the name “com.mycompany.myapp.item_a”?

And I’m pretty sure my app is not making conflict with the others, they are very different.

Thanks again everyone.

Yes Jose.

you need to give your items the exact same name. on both side with full “com.company.game.item_a”.

I think that is your problem. try it out.

Ok, so all the items added to the console must have a product id like “com.company.game.item_a”? Or is that the title?

All my products have id like “item_a”, but I’m calling purchases operation like “com.company.game.item_a”. If I call the purchase operation with “item_a” will it work? Or do I really need the id like “com.company.game.item_a”? If it is, it will take me some hours to test it after adding them.

I think both ways should work. Try this: make a dummy/fake item, which is just a regular item on the store but only for testing porpuses.

make two of them. one with only the name of the item, the other with the full “com.company.game.item_a”. Inside your code

when calling for purchase - insert the exact name you used in the store. Test them after the are being created (that should take normally a couple of hours, maybe less until store is updated with your items and updates).  In your code, just comment out a normal item you are selling and place the test items’ name. After you are done testing, just remove the test items from the store and use what worked best for you.

Thank you so much smithsun00, it worked! The product id needed to be the full app id and name.

No problem. I had the same problem, and went crazy while trying to figure out what I did wrong. It was just when I was about to release my game and took me like 3 weeks to find out that little mistake that got away under my nose.

Good luck.

Ok, I have another problem now. The transaction callback is only acessed when I cancel a purchase, it is never called when I buy or restore…

I have been there! :slight_smile:

Ok first things first,

When you try to restore you will get a call back only if you have already purchased the item, otherwise you will not get a call back.

And i dont see why you will not get a callback for purchase, perhaps can you put your code here, so that we can actually see what are you doing wrong

and one more weird thing that i faced is, if there are any exceptions inside your listener function it will not be thrown (app will not quit).

Lets say you had a nil access somewhere in your listener function and that piece of code is executed in the purchase flow, then you will not get any exceptions (like ‘trying to access nil value’), instead it will skip executing the next lines.

But i think i was getting those exceptions in the console but my app didnt crash.

just make sure there arent any nil access in the listener function.

Yes, it might be something you are trying to do inside the callback function, like unlocking content (items/power-ups etc.). One of those things maybe causing an error which just makes your function not really executed as it should. It can also be something like using ‘restore’ at the start of app, but never end transaction or store initiation which should be called at end of action inside callback function. (if i am not mistaken this is not the case with the new v3 of the google play)

What type of item are you trying to buy? is it consumable like power up or a temporary buff? or is it a permanent item like a sword?

If it is the first or if you did not configure that right inside the consul then you may already have bought it and you just don’t get the “Item already owned” error. 

Try adding something like :

native.showAlert(“error!”, “sorry, transection could not be completed at this time. Please try again later”, {“Okay”});

inside each sections of the callback function where you ask what is the response from the store to locate where is the problem.

Of course change the text inside for each one to separate them from each other.