Search code examples
firebaseflutterapigetstream-io

StreamWebSocketError api_key not found, data


I'm new to flutter and i am trying to run a chat app with getstream and firebase but i keep running into errors error im running into


Solution

  • Make sure that your API Key is correctly entered in your code. From your Stream Dashboard you can access your Stream app's API Key and Secret. It might be that the key you're entering is for a Stream app that was deleted, or there is a typo.

    Make sure that the API key for your APP there matches exactly with what you pass into your Stream client:

    final client = StreamChatClient(
      'YOUR-KEY', // Make sure this is correct.
      logLevel: Level.INFO,
    );
    

    I noticed in the screenshot you shared that you also have a kSecretStreamKey in your code base. Your secret key is not meant to be used in your Flutter (frontend) application. The secret key is needed to perform sensitive operations on your server (backend) - for example, generating user frontend auth tokens. If you include the secret key in your Flutter codebase, you risk a malicious actor retrieving it by decompiling your application. Your Secret Key is the equivalent of a password.

    I recommend taking a look at the Stream Flutter tutorial page if you're still stuck: https://getstream.io/chat/flutter/tutorial/

    Or the Stream Flutter YouTube Playlist: https://www.youtube.com/watch?v=pO_MOJRqYlk&list=PLNBhvhkAJG6t-BxkRAnSqa67lm5C1mpKk