onepf / OpenIAB

Open In-App Billing for Google Play, SlideMe, Amazon Store, Nokia Store, Samsung Apps, Yandex.Store, Appland, Aptoide, AppMall and Fortumo.
http://onepf.org/openiab/
Apache License 2.0
476 stars 171 forks source link

Authentication required #431

Closed Cryptomane closed 6 years ago

Cryptomane commented 9 years ago

Hi, everybody.

I'm trying to use OpenIAB to handle a single purchase for a single product on a single store. (should be pretty simple and yet...)

That's the first time I try using IAB, and I'm on Unity3D.

The code seems to work fine, but when I click on the purchase button a Google Play window opens telling me that I need to authenticate to my Google account. This is really strange, because the button I'm use to init OpenIAB is the same that I use to log in on Google+, so I can check leaderboards and achievements without a problem, but OpenIAB can't see I'm already logged in.

Am I missing something?

EDIT: I'm on Android, and I already installed the Licensing Library and the Billing Library with my SDK Manager.

GrimReio commented 9 years ago

Hello! I believe this is not related to the library itself, if you get response from the store without errors. Might be something wrong with Wallet settings. Is purchase complete when you input your password?

Cryptomane commented 9 years ago

Thank you for the quick response.

The truth is that I never see a window that prompts for a password, the authentication error is the first window I see after pressing the purchase button.

Since I manage the purchase in the purchaseSucceededEvent, I can see that there is no effect.

I also already made in-app purchases with my device, so I think the problem might be somewhere in the process I made to set-up the app page or my code.

Could it be due to a mismatch from Developer Console apk and installed apk?

GrimReio commented 9 years ago

It should be signed with same keystore as apk in the store and have same version number in the manifest. Could you please post logs and exact error message?

GrimReio commented 9 years ago

Also if it's published only in beta channel, your account should be added to the beta tester list.

Cryptomane commented 9 years ago

Tried again on unity, then an error popped out:

Exception: JNI: Init'd AndroidJavaClass with null ptr!
UnityEngine.AndroidJavaClass..ctor (IntPtr jclass) (at C:/BuildAgent/work/ea95e74f6e5f192d/Runtime/Export/AndroidJavaImpl.cs:533)
UnityEngine.AndroidJavaObject.get_JavaLangClass () (at C:/BuildAgent/work/ea95e74f6e5f192d/Runtime/Export/AndroidJavaImpl.cs:511)
UnityEngine.AndroidJavaObject.FindClass (System.String name) (at C:/BuildAgent/work/ea95e74f6e5f192d/Runtime/Export/AndroidJavaImpl.cs:502)
UnityEngine.AndroidJavaClass._AndroidJavaClass (System.String className) (at C:/BuildAgent/work/ea95e74f6e5f192d/Runtime/Export/AndroidJavaImpl.cs:522)
UnityEngine.AndroidJavaClass..ctor (System.String className) (at C:/BuildAgent/work/ea95e74f6e5f192d/Runtime/ExportGenerated/Editor/AndroidJava.cs:91)
GooglePlayGames.Android.AndroidClient.GetActivity () (at Assets/GooglePlayGames/Platforms/Android/AndroidClient.cs:272)
GooglePlayGames.Android.AndroidClient.RunOnUiThread (System.Action action) (at Assets/GooglePlayGames/Platforms/Android/AndroidClient.cs:278)
GooglePlayGames.Android.AndroidClient..ctor () (at Assets/GooglePlayGames/Platforms/Android/AndroidClient.cs:65)
GooglePlayGames.PlayGamesClientFactory.GetPlatformPlayGamesClient () (at Assets/GooglePlayGames/Platforms/PlayGamesClientFactory.cs:26)
GooglePlayGames.PlayGamesPlatform.Authenticate (ILocalUser unused, System.Action`1 callback, Boolean silent) (at Assets/GooglePlayGames/ISocialPlatform/PlayGamesPlatform.cs:157)
GooglePlayGames.PlayGamesPlatform.Authenticate (ILocalUser localUser, System.Action`1 callback) (at Assets/GooglePlayGames/ISocialPlatform/PlayGamesPlatform.cs:132)
GooglePlayGames.PlayGamesLocalUser.Authenticate (System.Action`1 callback) (at Assets/GooglePlayGames/ISocialPlatform/PlayGamesLocalUser.cs:36)
SignInGoogle.Login () (at Assets/SignInGoogle.cs:96)
SignInGoogle.getTouches () (at Assets/SignInGoogle.cs:81)
SignInGoogle.Update () (at Assets/SignInGoogle.cs:33)
Cryptomane commented 9 years ago

How do I extract a log? I'm sorry, but I'm a total newbie on this.

GrimReio commented 9 years ago

You can use Android Studio IDE or logcat tool.

Cryptomane commented 9 years ago

Here is the log, i copied the whole section from the plugin initialization to the end of the execution.

I/Unity   ( 2519): ********** Android OpenIAB plugin initialized **********
I/Unity   ( 2519):  
I/Unity   ( 2519): (Filename: ./Runtime/ExportGenerated/AndroidManaged/UnityEngineDebug.cpp line: 54)
I/Unity   ( 2519): 
D/dalvikvm( 2519): GC_CONCURRENT freed 301K, 6% free 6226K/6599K, paused 12ms+3ms, total 42ms
I/dalvikvm( 2519): Could not find method android.view.View.getDisplay, referenced from method com.google.android.gms.internal.fq$b.f
W/dalvikvm( 2519): VFY: unable to resolve virtual method 3291: Landroid/view/View;.getDisplay ()Landroid/view/Display;
D/dalvikvm( 2519): VFY: replacing opcode 0x6e at 0x0009
D/dalvikvm( 2519): GC_CONCURRENT freed 417K, 8% free 6303K/6791K, paused 14ms+16ms, total 114ms
D/dalvikvm(  418): WAIT_FOR_CONCURRENT_GC blocked 0ms
D/dalvikvm(  418): GC_EXPLICIT freed 1488K, 41% free 14035K/23559K, paused 10ms+17ms, total 175ms
D/dalvikvm( 1850): GC_CONCURRENT freed 368K, 7% free 7958K/8519K, paused 4ms+4ms, total 51ms
I/ActivityManager(  418): START {cmp=com.eludo.tapsong/org.onepf.openiab.UnityProxyActivity (has extras) u=0} from pid 2519
E/Unity   ( 2519): The animation state  could not be played because it couldn't be found!
E/Unity   ( 2519): Please attach an animation clip with the name '' or call this function only for existing animations.
E/Unity   ( 2519):  
E/Unity   ( 2519): (Filename:  Line: 429)
E/Unity   ( 2519): 
I/ActivityManager(  418): START {cmp=com.android.vending/com.google.android.finsky.billing.lightpurchase.IabV3Activity (has extras) u=0} from pid -1
D/dalvikvm( 2519): GC_CONCURRENT freed 333K, 7% free 6427K/6855K, paused 12ms+22ms, total 71ms
I/ActivityManager(  418): Displayed com.eludo.tapsong/org.onepf.openiab.UnityProxyActivity: +236ms
I/ActivityManager(  418): Displayed com.android.vending/com.google.android.finsky.billing.lightpurchase.IabV3Activity: +135ms
D/dalvikvm( 2300): GC_CONCURRENT freed 284K, 6% free 6233K/6599K, paused 14ms+3ms, total 48ms
I/Unity   ( 2519): purchaseFailedEvent: User canceled. (response: -1005:User cancelled)
I/Unity   ( 2519):  
I/Unity   ( 2519): (Filename: ./Runtime/ExportGenerated/AndroidManaged/UnityEngineDebug.cpp Line: 54)
I/Unity   ( 2519): 
D/dalvikvm(  643): GC_CONCURRENT freed 965K, 12% free 8633K/9799K, paused 17ms+12ms, total 116ms
D/dalvikvm(  643): WAIT_FOR_CONCURRENT_GC blocked 0ms
D/dalvikvm(  643): GC_EXPLICIT freed 175K, 14% free 8474K/9799K, paused 14ms+3ms, total 93ms
W/ActivityManager(  418): Activity pause timeout for ActivityRecord{418e7be0 com.eludo.tapsong/com.unity3d.player.UnityPlayerNativeActivity}
I/ActivityManager(  418): Process com.eludo.tapsong (pid 2519) has died.
Cryptomane commented 9 years ago

Was it useful somehow?

Are there additional info you might require to determine the situation?

akarimova commented 9 years ago

@Cryptomane could you please attach an screenshot?

Cryptomane commented 9 years ago

Here is the screenshot of the dialog i get immediately after pushing on the purchase button.

screenshot_2015-01-15-12-51-09

EDIT: Maybe there's a misconception. With "purchase button" i mean the game button that triggers the Purchase function, not the actual purchase button of Google Play dialog

fudogorg commented 9 years ago

аналогичная проблема на двух разных гугл аккаунтах.

similar problem on two different Google accounts.

akarimova commented 9 years ago

Please take a look at http://android.stackexchange.com/questions/20369/getting-authentication-is-required-when-trying-to-access-the-play-store http://stackoverflow.com/questions/18629181/authentication-requied-you-need-to-sign-in-google-play-account-in-in-app-billi http://stackoverflow.com/questions/27797663/android-in-app-billing-error-you-need-to-sign-into-your-google-account

Looks like we can't do anything on our side to prevent such behavior..

ajaybirla commented 9 years ago

Hi @Cryptomane, May be you have got the solution till now but if not, here i can help you.

It seems you didn't published your .apk file under Alpha or Beta channel in Google Play Developer Console. You need to publish it as Google make it mandatory for developers to publich their .apk's for testing in-app purchase.

To publish your game click on the "Publish" buttton on the upper-right corner in the Google Play Developer Console.

akarimova commented 9 years ago

Hi everyone!

Thank you for the questions and answers. To be honest, we can't suggest anything here. Google Play can be chosen as a billing store only if a user is logged in. Otherwise - billing not supported by a store and it can be chosen. We've tried several times but not succeeded to reproduce:(

fromparis commented 9 years ago

hi,

it was iOS store, can you try iOS ?

On 29 Jan 2015, at 15:21, Anastasiia Karimova notifications@github.com wrote:

Hi everyone!

Thank you for the questions and answers. To be honest, we can't suggest anything here. Google Play can be chosen as a billing store only if a user is logged in. Otherwise - billing not supported by a store and it can be chosen. We've tried several times but not succeeded to reproduce:(

— Reply to this email directly or view it on GitHub https://github.com/onepf/OpenIAB/issues/431#issuecomment-72031981.

akarimova commented 9 years ago

@GrimReio iOS?

akarimova commented 9 years ago

@fromparis сould you please provide more details: authentication + iOS + ???

ajaybirla commented 9 years ago

Hmmmm, looks like a lot of confusion here.

@Cryptomane @fudogorg @akarimova The solution for your problem might be publishing your app or game into alpha or beta channel of Google Play Developer Console. Please tell us that did you tried it or not? If yes, what's the outcome?

@fromparis What's your issue? Need more information. This issue is related to Android only.

Cryptomane commented 9 years ago

The game has just been published in beta channel, but I still encounter the same issue.

Do I need to wait some hours for changes to be effective or does updates get active immediately after upload?

ajaybirla commented 9 years ago

Great @Cryptomane Please wait for some time and let us know the result.

Born2Go commented 9 years ago

any news in this thread? I have allmost the same setup -> unity3d deploying an android app (dev env = win7/64) I'm having the same problem here. (screen telling that it's mandatory authentication. and should login in my account but account is logged and in test-group and in alpha channel google+ tester group too) currently waiting google publish my app to check if this problem go away as @ajaybirla said

Cryptomane commented 9 years ago

It worked, thank you!

ajaybirla commented 9 years ago

@Cryptomane, It's Good. Enjoy. @Born2Go What about you friend?

akarimova commented 9 years ago

@ajaybirla thank you for your help!

Born2Go commented 9 years ago

Hello All: I switched to blueStack emulator and used the same account I was using in my company phone, and it worked. didnt tested again in the real device but I'll report here when I re-test it (and if I found the same bug there) thank you all !

Cryptomane commented 6 years ago

Wow, I left this open for way too long. Time to clean up after myself, thanks again for the help!