Skip to main content
Question

Invalid API Key Error (Code: 11) During SDK Initialization

  • September 27, 2025
  • 1 reply
  • 37 views

Forum|alt.badge.img

## Description

 

Getting "Invalid API Key" error when initializing RevenueCat Flutter SDK despite using valid API keys.

 

**Error:**

```

RevenueCat Platform Exception: There was a credentials issue. Check the underlying error for more details. Invalid API Key. (Code: 11)

```

 

**Code:**

```dart

await Purchases.configure(

PurchasesConfiguration(apiKey)

);

 

// Test the connection

final customerInfo = await Purchases.getCustomerInfo();

```

This post has been closed for comments

1 reply

guilherme
RevenueCat Staff
Forum|alt.badge.img+6
  • RevenueCat Staff
  • October 1, 2025

Hey ​@ahmtydn ,

Are you supporting multiple platforms in your Flutter app? Our recommended approach is to do something like this:

import 'dart:io' show Platform;

//...

Future<void> initPlatformState() async {
await Purchases.setLogLevel(LogLevel.debug);

PurchasesConfiguration configuration;
if (Platform.isAndroid) {
configuration = PurchasesConfiguration(<public_google_api_key>);
if (buildingForAmazon) {
// use your preferred way to determine if this build is for Amazon store
// checkout our MagicWeather sample for a suggestion
configuration = AmazonConfiguration(<public_amazon_api_key>);
}
} else if (Platform.isIOS) {
configuration = PurchasesConfiguration(<public_apple_api_key>);
}
await Purchases.configure(configuration);
}

more context here

Could you also check you’re using the correct key for each environment? Your Google one will start with goog_... and the Apple one as appl_....

Also, we recommend enabling the SDK Debug Logs, as that will help in seeing what the SDK is doing under the hood.

Best,