Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid API key #260

Closed
AndrewRudyk opened this issue Feb 6, 2025 · 3 comments
Closed

Invalid API key #260

AndrewRudyk opened this issue Feb 6, 2025 · 3 comments
Labels
question Further information is requested

Comments

@AndrewRudyk
Copy link

Hello,

I've created the project in app.eu.amplitude.com/analytics
I've added Amplitude to my project using the tutorial https://amplitude.com/docs/sdks/analytics/ios/ios-swift-sdk

import AmplitudeSwift

class AnalyticsService {
    static let shared = AnalyticsService()
    
    private let amplitudeInstance: Amplitude
    
    init() {
        let conf = Configuration(apiKey: "my_api_key",
                                 logLevel: .DEBUG)
        self.amplitudeInstance = Amplitude(configuration: conf)
    }
    
    func log(event: String, parameters params: [String : Any] = [:]) {
        amplitudeInstance.track(eventType: event, eventProperties: params, options: nil)
    }
}
@main
struct MyApp: App {
    init() {
        let _ = AnalyticsService.shared
    }
    
    var body: some Scene {
...

but I only see one error
Error: Response failed with code400: {"code":400,"error":"Invalid API key: my_api_key"}

What is the reason for this error and how can I fix it?

@AndrewRudyk AndrewRudyk added the question Further information is requested label Feb 6, 2025
@izaaz
Copy link
Collaborator

izaaz commented Feb 6, 2025

@AndrewRudyk could you please set the serverZone parameter in config to EU?

@AndrewRudyk
Copy link
Author

@izaaz Thank you so much for answer! It works:)
But if an App will be launched outside EU what value shoud be set for serverZone parameter?

@crleona
Copy link
Collaborator

crleona commented Feb 6, 2025

ServerZone is where the account is hosted (usually for data privacy reasons). It should accept global traffic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants