[in_app_purchase] iOS Always prompting for authentication on every purchase in sandbox mode
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);
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
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!
This is on the new 0.6.0 version as well the version i was using was ^0.5.2
As far as I know, this is only happening in sandbox environment (I'm not sure at all)
lol hopefully I'm not the one to find out, i go live in 2 weeks or so.
@nt4f04uNd Correct
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?

If I enter user and password of sandbox user, console gives ui_dart_state.cc Unhandled Exception: Instance of 'SKError' error.
Any idea?
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
as you can see no code appears:

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.
O this is is different, I didn’t see your first screenshot I would file another ticket.
https://github.com/flutter/flutter/issues/94269
@jeremiahlukus One question: Do I need to log in with my test sandbox account in the emulator before opening the app?
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
Run in iOS 15.0 emulator
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?
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?
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...
Running into the same issue here.
No updates?
The problem still exists, every time await InAppPurchase.instance.restorePurchases(); is called; Will trigger a window change
Any updates on this? I Still get this error :(
I also get the same error
@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.
Same issue here as well
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
This only occurred in sandbox for me, if this is happening outside sandbox you should probably check your config.

