bizz84 / SwiftyStoreKit

Lightweight In App Purchases Swift framework for iOS 8.0+, tvOS 9.0+ and macOS 10.10+ ⛺
MIT License
6.58k stars 795 forks source link

No auth plugin to verify credentials for accounts of type com.apple.account.iTunesStore.sandbox #642

Open ServusJon opened 3 years ago

ServusJon commented 3 years ago

I always get an error when trying to fetch prices of auto renewable subscriptions. Any idea?

ServusJon commented 3 years ago

When I use a local storekit file it all works fine. I only get the issues when I try to use the submitted in app purchases

ServusJon commented 3 years ago

<SKReceiptRefreshRequest: 0x6000015ce980>: Finished refreshing receipt with error: Error Domain=ASDErrorDomain Code=500 "Unhandled exception" UserInfo={NSUnderlyingError=0x600001b3dfb0 {Error Domain=AMSErrorDomain Code=100 "Authentication Failed" UserInfo={NSLocalizedFailureReason=The verify credentials call failed., NSLocalizedDescription=Authentication Failed, NSUnderlyingError=0x600001b3c510 {Error Domain=com.apple.accounts Code=4 "No auth plugin to verify credentials for accounts of type com.apple.account.iTunesStore.sandbox" UserInfo={NSLocalizedDescription=No auth plugin to verify credentials for accounts of type com.apple.account.iTunesStore.sandbox}}}}, NSLocalizedFailureReason=An unknown error occurred, NSLocalizedDescription=Unhandled exception}

Haris2v commented 1 year ago

I'm facing the same issue. Did anybody figured it out ?

visaals commented 1 year ago

Getting a similar error now on an iOS simulator trying to test sandbox payments with expo and revenue cat. Not sure if related.

[StoreKit] <SKPaymentQueue: 0x6000021006a0>: Payment completed with
error: Error Domain=ASDErrorDomain Code=500 "Unhandled exception"
UserInfo={NSUnderlyingError=0x600002d34c00 {Error Domain=AMSErrorDomain
Code=100 "Authentication Failed"
UserInfo={NSMultipleUnderlyingErrorsKey=(
"Error Domain=AMSErrorDomain Code=2 \"An unknown error occurred. Please
try again.\" UserInfo={NSLocalizedDescription=An unknown error occurred.
Please try again.}",
"Error Domain=com.apple.accounts Code=4 \"No auth plugin to verify
credentials for accounts of type com.apple.account.iTunesStore.sandbox\"
UserInfo={NSLocalizedDescription=No auth plugin to verify credentials
for accounts of type com.apple.account.iTunesStore.sandbox}"
), NSLocalizedDescription=Authentication Failed,
NSLocalizedFailureReason=The authentication failed.}},
storefront-country-code=USA, client-environment-type=Sandbox,
AMSServerErrorCode=0, NSLocalizedFailureReason=An unknown error
occurred, NSLocalizedDescription=Unhandled exception}
[StoreKit] <SKPaymentQueue: 0x6000021006a0>: Payment completed with
error: Error Domain=ASDErrorDomain Code=500 "Unhandled exception"
UserInfo={NSUnderlyingError=0x600002d31980 {Error Domain=AMSErrorDomain
Code=100 "Authentication Failed"
UserInfo={NSMultipleUnderlyingErrorsKey=(
"Error Domain=AMSErrorDomain Code=2 \"An unknown error occurred. Please
try again.\" UserInfo={NSLocalizedDescription=An unknown error occurred.
Please try again.}",
"Error Domain=com.apple.accounts Code=4 \"No auth plugin to verify
credentials for accounts of type com.apple.account.iTunesStore.sandbox\"
UserInfo={NSLocalizedDescription=No auth plugin to verify credentials
for accounts of type com.apple.account.iTunesStore.sandbox}"
), NSLocalizedDescription=Authentication Failed,
NSLocalizedFailureReason=The authentication failed.}},
storefront-country-code=USA, client-environment-type=Sandbox,
AMSServerErrorCode=0, NSLocalizedFailureReason=An unknown error
occurred, NSLocalizedDescription=Unhandled exception}
Haris2v commented 1 year ago

I just figure out how to resolve this issue: Open xcodeworkspace file in xCode. File -> New -> File -> StorekitConfiguration File. Give a name to this file. And click on sync. Select correct team and app and save anywhere in your project.

Now Got to Product -> Scheme -> Edit Scheme. Select run from the left and click on options menu and choose that saved file for StoreKit configuration field.

Run the app using xCode. I believe this will fix your issue

dvcrn commented 1 year ago

Facing a similar issue, wasn't able to get to the root of it yet

Same setup, using Revenue Cat. Created a StoreKit configuration file pretty much as instructed by the docs. Tried both ways, a local StoreKit file and a synced file, added it to a new scheme and built with that

Created sandbox users on appstore connect, logged in with those users into iCloud.com on device to go through the accept terms process. Tried using those sandbox users within Simulator (not physical device) to purchase something

[StoreKit] <SKPaymentQueue: 0x600003f7e7b0>: Payment completed with error: Error Domain=ASDErrorDomain Code=500 "(null)"
UserInfo={client-environment-type=Sandbox, storefront-country-code=USA, NSUnderlyingError=0x600003179050 {Error
Domain=AMSErrorDomain Code=100 "Authentication Failed" UserInfo={NSMultipleUnderlyingErrorsKey=(
"Error Domain=AMSErrorDomain Code=2 \"An unknown error occurred. Please try again.\" UserInfo={NSLocalizedDescription=An
unknown error occurred. Please try again.}",
"Error Domain=com.apple.accounts Code=4 \"No auth plugin to verify credentials for accounts of type
com.apple.account.iTunesStore.sandbox\" UserInfo={NSLocalizedDescription=No auth plugin to verify credentials for accounts of
type com.apple.account.iTunesStore.sandbox}"
), NSLocalizedDescription=Authentication Failed, NSLocalizedFailureReason=The authentication failed.}}}

My IAP is not live yet, just prepared in the app submission and configured within Revenue Cat. It fetches those just fine, just the sandbox stuff and testing isn't working.

@visaals did you figure out what was causing your issue?

Haris2v commented 1 year ago

@dvcrn Have you tried this ?

dvcrn commented 1 year ago

Yes, both with an automatically synced StoreKit file, and with a local file. Both didn't do it for me after including them into the building scheme

Haris2v commented 1 year ago

@dvcrn Please open xCode, click on product from top menu and do a 'Clean Build Folder'. After that verify again that you have successfully added store configuration file, recheck this comment if needed. And the most important thing is you need to run your app through xCode for the first time. And then you can install you app using Android Studio or VS code or whatever IDE you use. This test purchase feature will work unless and until you keep your app installed, once uninstalled you again need to run your app from xCode.

In very short, run your app from xCode in order to test in-app-purchases. I hope this will help :)

dvcrn commented 1 year ago

Got it working, the trick was indeed to do a manual xcode build, and not through xcodebuild or eas/expo 👍