flutter icon indicating copy to clipboard operation
flutter copied to clipboard

[in_app_purchase] iOS Always prompting for authentication on every purchase in sandbox mode

Open jeremiahlukus opened this issue 4 years ago • 17 comments

On IOS only after every purchase it prompts the user for their apple id and password. This behavior exists after deploying to test flight as well.

i am doing to make the purchase. The purchase works its just asking me for my apple id and password its doing the same for all my beta testers as well.

     ProductDetails prod = _products.where((item) => item.id == productId).first;
      final PurchaseParam purchaseParam = PurchaseParam(productDetails: prod);
      await _iap.buyConsumable(purchaseParam: purchaseParam);
      
      ...
      ...
     await _iap.completePurchase(purchaseDetails);
Screen Shot 2021-05-12 at 9 12 27 PM

jeremiahlukus avatar May 13 '21 01:05 jeremiahlukus

Hi @jeremiahlukus Thanks for filing the issue, I have noticed this behavior when testing in_app_purchase

I just now compared this behavior from in_app_purchase with the native iOS app using In-App Purchases. The native app doesn't ask for authentication every time you buy the consumable.

Below you can see in Flutter, I've already purchased a few consumables, yet I am presented with an authentication sheet. On the native app, I can keep buying without an authentication sheet popping up (check the logs below)

Preview

flutter nativeiOS

Native iOS logs

Transaction Successful
Transaction Successful
Transaction Successful
Transaction Successful
Transaction Successful
Transaction Successful
Transaction Successful
Transaction Successful
Transaction Successful
Transaction Successful
Transaction Successful
Transaction Successful
Transaction Successful
Transaction Successful

Code Sample

Official sample

Reproduced on the following channel

stable

Check flutter doctor -v outputs for each channel below

flutter doctor -v
[✓] Flutter (Channel stable, 2.0.6, on macOS 11.3 20E232 darwin-x64, locale
    en-GB)
    • Flutter version 2.0.6 at /Users/tahatesser/Code/flutter_stable
    • Framework revision 1d9032c7e1 (13 days ago), 2021-04-29 17:37:58 -0700
    • Engine revision 05e680e202
    • Dart version 2.12.3

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Volumes/Extreme/SDK
    • Platform android-30, build-tools 30.0.3
    • ANDROID_HOME = /Volumes/Extreme/SDK
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Volumes/Extreme/Xcode.app/Contents/Developer
    • Xcode 12.5, Build version 12E262
    • CocoaPods version 1.10.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)

[✓] VS Code (version 1.56.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.22.0

[✓] Connected device (3 available)
    • Taha’s iPhone (mobile) • 00008020-001059882212002E • ios            • iOS
      14.5.1
    • macOS (desktop)        • macos                     • darwin-x64     •
      macOS 11.3 20E232 darwin-x64
    • Chrome (web)           • chrome                    • web-javascript •
      Google Chrome 90.0.4430.212

• No issues found!

TahaTesser avatar May 13 '21 11:05 TahaTesser

This is on the new 0.6.0 version as well the version i was using was ^0.5.2

jeremiahlukus avatar May 13 '21 16:05 jeremiahlukus

As far as I know, this is only happening in sandbox environment (I'm not sure at all)

nt4f04uNd avatar May 14 '21 13:05 nt4f04uNd

lol hopefully I'm not the one to find out, i go live in 2 weeks or so.

jeremiahlukus avatar May 14 '21 13:05 jeremiahlukus

@nt4f04uNd Correct

TahaTesser avatar May 14 '21 14:05 TahaTesser

Every time I run my app in the simulator to test or in the app this Sign in window appears. Is this window from the sanbox?

aaa

If I enter user and password of sandbox user, console gives ui_dart_state.cc Unhandled Exception: Instance of 'SKError' error.

Any idea?

mdmota avatar Nov 27 '21 00:11 mdmota

Yes my issue was only in sandbox (having to put in the email password every time). Skerror depends on what code it’s returning

https://developer.apple.com/documentation/storekit/skerror/code

jeremiahlukus avatar Nov 27 '21 00:11 jeremiahlukus

as you can see no code appears: xxxx

mdmota avatar Nov 27 '21 00:11 mdmota

When running the App in the emulator, when I call InAppPurchase.instance.restorePurchases() this Sign in window appears. This window does not appear to be from the sandbox.

mdmota avatar Nov 27 '21 00:11 mdmota

O this is is different, I didn’t see your first screenshot I would file another ticket.

jeremiahlukus avatar Nov 27 '21 00:11 jeremiahlukus

https://github.com/flutter/flutter/issues/94269

mdmota avatar Nov 27 '21 00:11 mdmota

@jeremiahlukus One question: Do I need to log in with my test sandbox account in the emulator before opening the app?

mdmota avatar Nov 27 '21 01:11 mdmota

Yes my issue was only in sandbox (having to put in the email password every time). Skerror depends on what code it’s returning

https://developer.apple.com/documentation/storekit/skerror/code

SKerror code 0b Run in iOS 15.0 emulator

mdmota avatar Nov 28 '21 22:11 mdmota

Every time I run my app in the simulator to test or in the app this Sign in window appears. Is this window from the sanbox?

aaa

If I enter user and password of sandbox user, console gives ui_dart_state.cc Unhandled Exception: Instance of 'SKError' error.

Any idea?

I'm also still running into this issue in the simulator, also being prompted the login all the time which is quite annoying. Anyone still have this under his watch?

patreu22 avatar Jun 17 '22 09:06 patreu22

Why is this issue closed? All the referenced issues are closed as well without resolution...

I am seeing the same problem on simulator. After every flutter run, and at a purchase attempt I am getting the login popup...

giorgio79 avatar Feb 03 '23 19:02 giorgio79

Running into the same issue here.

erictu22 avatar Jun 05 '23 19:06 erictu22

No updates?

luizdebem avatar Jul 14 '23 13:07 luizdebem

The problem still exists, every time await InAppPurchase.instance.restorePurchases(); is called; Will trigger a window change

image

sherwin avatar Aug 04 '23 06:08 sherwin

Any updates on this? I Still get this error :(

marekhalmo avatar Aug 23 '23 05:08 marekhalmo

I also get the same error

antonkarliner avatar Dec 19 '23 20:12 antonkarliner

@danagbemava-nc What is this insanity ? #94011 is closed so I'm posting here. If a user on IOS tries to make a purchase but doesn't complete it, it stays pending. Afterwards, if he tries again, you get an exception saying you have to complete the purchase. However, now that there are 2 pending transactions, calling restorePurchases will raise an exception, and you will never be able to complete the purchase ! This is completely blocking purchases and is the worst possible behavior for this plugin to have. You never, never prevent the obtention of this data because of an arbitrary "there's 2 of own" exception ! Please read #94011 attentively to understand how grave this problem is.

TheCarpetMerchant avatar Dec 23 '23 00:12 TheCarpetMerchant

Same issue here as well

incrediblezayed avatar Apr 19 '24 17:04 incrediblezayed

Has anyone managed to fix this problem? I'm using version 3.2.0, I'm not in the sandbox, and the dialog continues to appear whenever I perform any operation, such as fetching details or starting a transaction

Gilianp avatar May 06 '24 04:05 Gilianp

This only occurred in sandbox for me, if this is happening outside sandbox you should probably check your config.

jeremiahlukus avatar May 06 '24 12:05 jeremiahlukus