SDK error · code 11

invalidCredentialsError (error code 11): Invalid credentials

What it means

invalidCredentialsError (code 11) means the backend rejected the SDK's API key or an auth token as invalid, usually backend code 7225 (invalid API key) or 7224 (invalid auth token). Every call fails until the key is right. Copy the app's public SDK key again, check it belongs to the server the SDK talks to, and set the proxy URL before configure.

Code

11

iOS (Swift)

ErrorCode.invalidCredentialsError

Android (Kotlin)

PurchasesErrorCode.InvalidCredentialsError

Causes

Why the SDK returns invalidCredentialsError

  • The backend answered 7225 (invalid API key) or 7224 (invalid auth token). iOS also maps 7104 (invalid App Store shared secret) and 7981 (invalid IAM token), and Android also maps 7107 (invalid Play Store credentials) (BackendErrorCode.swift, errors.kt).
  • The key has a typo, or it belongs to another project or another server. A RevenueCat key sent to RevenueDot, or the reverse, is unknown.
  • The proxy URL was set after configure, so the first requests went to the wrong host with this key.
  • A key of the wrong kind: a test_ Test Store key in a release build, or a key from a different platform's app.
  • A subscriber access token that expired or names another app user ID.
Backend codeMeaning
7225Invalid API key.
7224Invalid auth token.
7104Invalid App Store shared secret (iOS mapping).
7981Invalid IAM token (iOS mapping).
7107Invalid Play Store credentials (Android mapping).

Fix

How to fix invalidCredentialsError

  1. 01

    Copy the key again

    Copy the app's public SDK key from the app page, or call GET /v2/projects/{project_id}/apps/{app_id}/public_api_keys with your secret key. Check each character.

  2. 02

    Set the proxy URL first

    Set Purchases.proxyURL before Purchases.configure. See the SDK guides.

  3. 03

    Match key and platform

    Use the iOS app's key in the iOS build and the Android app's key in the Android build. Ship store keys in release builds and test_ keys only in development builds.

  4. 04

    Run the health check

    On iOS, PurchasesDiagnostics.default.testSDKHealth() maps this error to an "invalid API key" result, which confirms the key is the problem.

In your app

How to handle it in code

  • Do not retry. The key stays wrong until you fix it.
  • Show a generic "service unavailable" message to customers and send an alert to yourself. Customers cannot fix this.
  • Do not grant access from the error. Customers who already paid keep the access the SDK has cached.
Match the errorSwift · Kotlin
// Swift
do {
  let result = try await Purchases.shared.purchase(package: package)
} catch let error as ErrorCode where error == .invalidCredentialsError {
  // handle invalid credentials
}

// Kotlin
if (error.code == PurchasesErrorCode.InvalidCredentialsError) { /* ... */ }

On RevenueDot: RevenueDot answers HTTP 401 with code 7225 and the message "Invalid API Key." when the Authorization: Bearer key is missing or unknown. A subscriber access token (rdat_) that has expired, or that names another app user ID, gets 401 with 7224. The health endpoints need no key. See common problems.

FAQ

invalidCredentialsError: questions people ask

What is RevenueCat error 7225?

Backend code 7225 means the API key is invalid. The SDK reports it as invalidCredentialsError (code 11). Check the key, the project and the proxy URL.

Why do I get invalid credentials after switching to RevenueDot?

The key is from a different server, or the proxy URL was set after configure. Use the public key of an app in your RevenueDot project and set the proxy URL first.

How do I check for invalidCredentialsError in React Native and Flutter?

In React Native, compare error.code with PURCHASES_ERROR_CODE.INVALID_CREDENTIALS_ERROR. In Flutter, convert the PlatformException with PurchasesErrorHelper.getErrorCode(e) and compare the result with PurchasesErrorCode.invalidCredentialsError.

Get started

Keep the RevenueCat SDK. Change the backend.

RevenueDot answers the same SDK calls with the same error codes. Start free on RevenueDot Cloud, free up to $10,000 a month in tracked revenue.

Already have an account? Sign in · Prefer your own servers? Self-host free