### Install Firebase CLI and Stream Auth Extension via CLI Source: https://github.com/getstream/stream-firebase-extensions/blob/main/auth-activity-feeds/README.md This snippet provides the necessary bash commands to install the Firebase CLI globally and then install the Stream Feeds authentication extension using the Firebase CLI. It's a two-step process for setting up the extension from the command line, requiring a project ID for installation. ```bash npm install -g firebase-tools firebase ext:install stream/auth-activity-feeds --project=[your-project-id] ``` -------------------------------- ### Install Firebase CLI Globally Source: https://github.com/getstream/stream-firebase-extensions/blob/main/firestore-activity-feeds/README.md This command installs the Firebase command-line interface globally using npm, or updates it to the latest version if already installed. It's a prerequisite for managing Firebase projects and extensions via the CLI. ```bash npm install -g firebase-tools ``` -------------------------------- ### Install Stream Firestore Activity Feeds Firebase Extension Source: https://github.com/getstream/stream-firebase-extensions/blob/main/firestore-activity-feeds/README.md This command installs the 'stream/firestore-activity-feeds' extension into a specified Firebase project using the Firebase CLI. Replace `[your-project-id]` with your actual Firebase project ID. ```bash firebase ext:install stream/firestore-activity-feeds --project=[your-project-id] ``` -------------------------------- ### Stream Firestore Activity Feeds Extension Configuration Parameters Source: https://github.com/getstream/stream-firebase-extensions/blob/main/firestore-activity-feeds/README.md This section details the essential parameters required to configure the Stream Firestore Activity Feeds extension during installation. These settings control deployment location, API credentials, and how user display information is mapped from Firebase to Stream Activity Feeds. ```APIDOC Cloud Functions location: - Description: Where to deploy the functions created for this extension. - Reference: [location selection guide](https://firebase.google.com/docs/functions/locations) API key for the Stream API: - Description: Your Stream API key. API secret for the Stream API: - Description: Your Stream API secret. Display name field: - Description: The field in the Activity Feed User object where the Firebase user's display name should be saved. Email field: - Description: The field in the Activity Feed User object where the Firebase user's email should be saved. Profile image field: - Description: The field in the Activity Feed User object where the Firebase user's profile image should be saved. ``` -------------------------------- ### Install Firebase CLI Globally Source: https://github.com/getstream/stream-firebase-extensions/blob/main/auth-chat/README.md This command installs or updates the Firebase Command Line Interface (CLI) globally using npm. The Firebase CLI is essential for managing Firebase projects and extensions from your terminal. ```bash npm install -g firebase-tools ``` -------------------------------- ### Install Stream Chat Firebase Extension via CLI Source: https://github.com/getstream/stream-firebase-extensions/blob/main/auth-chat/README.md This command installs the Stream Chat authentication extension into a specified Firebase project using the Firebase CLI. Replace '[your-project-id]' with the actual ID of your Firebase project. ```bash firebase ext:install stream/auth-chat --project=[your-project-id] ``` -------------------------------- ### Stream Auth Extension Configuration Parameters Source: https://github.com/getstream/stream-firebase-extensions/blob/main/auth-activity-feeds/README.md This section details the required configuration parameters for the Stream Feeds authentication extension. These parameters are set during the extension installation process and control its behavior, including deployment location, API credentials, and how user data fields (display name, email, profile image) are mapped from Firebase Authentication to the Activity Feed User object. ```APIDOC Cloud Functions location: Description: Where to deploy the functions created for this extension. Type: String Constraints: Must be a valid Firebase Cloud Functions region. API key for the Stream API: Description: Your Stream API key. Type: String Constraints: Required for Stream API authentication. API secret for the Stream API: Description: Your Stream API secret. Type: String Constraints: Required for Stream API authentication. Display name field: Description: The field in the Activity Feed User object where the Firebase user's display name should be saved. Type: String Constraints: Must be a valid field name. Email field: Description: The field in the Activity Feed User object where the Firebase user's email should be saved. Type: String Constraints: Must be a valid field name. Profile image field: Description: The field in the Activity Feed User object where the Firebase user's profile image should be saved. Type: String Constraints: Must be a valid field name. ``` -------------------------------- ### Run Project Tests Source: https://github.com/getstream/stream-firebase-extensions/blob/main/integration-tests/README.md This command executes the test suite for the entire project. It is the standard way to verify the functionality and integrity of the Firebase extensions. ```bash npm test ``` -------------------------------- ### Configure Public Environment Variables for Auth Chat Extension Source: https://github.com/getstream/stream-firebase-extensions/blob/main/integration-tests/README.md This snippet shows the structure of the `extensions/auth-chat.env.local` file, containing public environment variables such as the deployment location and Stream API key specific to the chat extension. These are necessary for local operation and testing. ```env LOCATION= STREAM_API_KEY= ``` -------------------------------- ### Configure Public Environment Variables for Auth Activity Feeds Extension Source: https://github.com/getstream/stream-firebase-extensions/blob/main/integration-tests/README.md This snippet shows the structure of the `extensions/auth-activity-feeds.env.local` file, which contains public environment variables like the deployment location and Stream API key. These variables are essential for the extension to function correctly in a local development environment. ```env LOCATION= STREAM_API_KEY= ``` -------------------------------- ### Configure Secret Environment Variable for Auth Activity Feeds Extension Source: https://github.com/getstream/stream-firebase-extensions/blob/main/integration-tests/README.md This snippet illustrates the `extensions/auth-activity-feeds.secret.local` file, which holds the sensitive Stream API secret. This secret is critical for authenticating with the Stream API and should be handled securely, typically generated automatically in CI environments. ```env STREAM_API_SECRET= ``` -------------------------------- ### Configure Secret Environment Variable for Auth Chat Extension Source: https://github.com/getstream/stream-firebase-extensions/blob/main/integration-tests/README.md This snippet illustrates the `extensions/auth-chat.secret.local` file, which stores the sensitive Stream API secret for the chat extension. Similar to other secrets, it's crucial for API authentication and is typically managed securely in CI. ```env STREAM_API_SECRET= ``` -------------------------------- ### Firestore Document Structure and Activity Fields for Stream Sync Source: https://github.com/getstream/stream-firebase-extensions/blob/main/firestore-activity-feeds/POSTINSTALL.md This specification details the required Firestore document path structure and the minimum fields necessary within the document for the Firebase extension to correctly process and sync activities to Stream Activity Feeds. The path components define the hierarchical organization in Firestore that maps to Stream's feed structure, while the fields define the core properties of the activity. ```APIDOC Firestore Document Path Structure: ${COLLECTION}/{feedId}/{userId}/{foreignId} - COLLECTION: The root collection ID configured for the extension (e.g., 'activities'). - feedId: Corresponds to a Stream feed group (e.g., 'user', 'flat', 'notification'). - userId: Corresponds to a specific user's ID within the feed group (e.g., '123', 'user_alice'). - foreignId: A unique identifier for the activity from your application (e.g., 'pin:1', 'like:300'). Required Activity Fields within Document: - actor: The ID of the actor performing the activity (e.g., 'user:456'). - verb: The action performed (e.g., 'post', 'like', 'follow'). - object: The ID of the object of the activity (e.g., 'post:789', 'photo:101'). Automatically Determined Fields (not required in document): - time: Timestamp of the activity. - foreign_id: Automatically derived from the document's foreignId path component. ``` -------------------------------- ### Expected Firestore Document Path for Stream Feeds Source: https://github.com/getstream/stream-firebase-extensions/blob/main/firestore-activity-feeds/README.md This snippet illustrates the expected path structure for Firestore documents that the Stream Activity Feeds extension will process. The `feeds` segment is configurable via the `COLLECTION` parameter, while `feedId`, `userId`, and `foreignId` are placeholders for dynamic values. ```bash feeds/{feedId}/{userId}/{foreignId} ``` -------------------------------- ### Firestore Document Path Structure for Stream Activity Feeds Source: https://github.com/getstream/stream-firebase-extensions/blob/main/firestore-activity-feeds/PREINSTALL.md Defines the expected path structure for Firestore documents that the Stream Firebase extension monitors. The 'feeds' collection name is customizable via the 'COLLECTION' parameter, allowing flexible integration with existing data models. ```bash feeds/{feedId}/{userId}/{foreignId} ``` -------------------------------- ### Required Firestore Document Fields for Stream Activity Feeds Source: https://github.com/getstream/stream-firebase-extensions/blob/main/firestore-activity-feeds/PREINSTALL.md Specifies the minimum required fields within Firestore documents for the Stream Firebase extension to correctly create activities. These fields map directly to core activity components, ensuring proper data synchronization with Stream's Activity Feeds. ```APIDOC Firestore Document Fields: actor: string - Description: The entity performing the activity. verb: string - Description: The type of action performed on the activity. object: string - Description: The content of the activity itself (often a reference to another document or entity). ``` -------------------------------- ### Firebase Functions for Stream Chat Token Management Source: https://github.com/getstream/stream-firebase-extensions/blob/main/auth-chat/POSTINSTALL.md This section details the Firebase Functions provided by the extension for managing authentication tokens used with the Stream Chat API or SDKs. These functions allow for generating and revoking user-specific tokens. ```APIDOC Firebase Functions: getStreamUserToken - Description: Generates an authentication token suitable for use with the Stream Chat API or SDKs for a given Firebase user. - Parameters: - uid (string, optional): The Firebase User ID for whom to generate the token. If not provided, the token is generated for the authenticated user making the request. - Returns: Promise - A promise that resolves with the generated Stream Chat authentication token. - Usage: Typically called from a client-side application or another backend service to obtain a token for a user to connect to Stream Chat. revokeStreamUserToken - Description: Revokes an existing Stream Chat authentication token for a given Firebase user, invalidating it for future use. - Parameters: - uid (string, optional): The Firebase User ID whose token should be revoked. If not provided, attempts to revoke the token for the authenticated user making the request. - Returns: Promise - A promise that resolves when the token has been successfully revoked. - Usage: Useful for security purposes, such as when a user logs out or their permissions change, to ensure old tokens are no longer valid. ``` -------------------------------- ### Required Fields for Firestore Documents in Stream Activity Feeds Source: https://github.com/getstream/stream-firebase-extensions/blob/main/firestore-activity-feeds/README.md This section outlines the minimum required fields that Firestore documents must contain for the Stream Activity Feeds extension to correctly process them into activities. These fields map directly to core components of an activity in Stream's Activity Feeds. ```APIDOC actor: - Description: The entity performing the activity. verb: - Description: The type of action performed on the activity. object: - Description: The content of the activity itself (often a reference). ``` -------------------------------- ### Stream Firebase Extension: Sync Firestore Data with Activity Feeds Source: https://github.com/getstream/stream-firebase-extensions/blob/main/README.md This extension automatically creates and keeps Stream Activity Feeds in sync with data from a specified Firestore collection in real-time. It leverages Stream's powerful feed infrastructure while using Firestore as the primary data source. ```APIDOC Extension Name: Firestore Activity Feeds Purpose: Synchronize data from a Firestore collection with Stream Activity Feeds. Capabilities: - Automatically create Activity Feeds from data in a Firestore collection. - Keep Firestore data in real-time synchronization with Stream Activity Feeds. - Leverage Stream's powerful feed infrastructure using Firestore as the database. Installation: - Via Firebase Console: https://console.firebase.google.com/project/_/extensions/install?ref=stream/firestore-activity-feeds ``` -------------------------------- ### Firebase Function: Generate Stream User Authentication Token Source: https://github.com/getstream/stream-firebase-extensions/blob/main/auth-activity-feeds/POSTINSTALL.md This Firebase Function is provided by the Stream Firebase extension to generate authentication tokens. These tokens are essential for securely authenticating users when interacting with the Stream Activity Feeds API or SDKs from client-side applications or other services. ```APIDOC ${function:getStreamUserToken.name} - Description: Generates a secure authentication token for use with the Stream Activity Feeds API and SDKs. - Purpose: To enable client-side applications to authenticate and interact with Stream services on behalf of a user. - Parameters: (Implicitly takes Firebase Authentication context to identify the user) - Returns: A string representing the Stream user authentication token. - Usage: Typically invoked as a callable Firebase Function from a client application to obtain a temporary token for Stream API calls. ``` -------------------------------- ### Stream Firebase Extension: Authenticate Activity Feeds with Firebase Authentication Source: https://github.com/getstream/stream-firebase-extensions/blob/main/README.md This extension securely generates Stream Activity Feeds user tokens using Firebase Authentication and synchronizes Firebase Authentication users with Stream Activity Feeds. It supports all Firebase Authentication methods. ```APIDOC Extension Name: Auth Activity Feeds Purpose: Authenticate users with Stream Activity Feeds via Firebase Authentication. Capabilities: - Securely generate Stream Activity Feeds user tokens using Firebase Authentication. - Synchronize Firebase Authentication users with Stream Activity Feeds. - Support for all Firebase Authentication methods (email/password, Google, Apple, Facebook, etc.). Installation: - Via Firebase Console: https://console.firebase.google.com/project/_/extensions/install?ref=stream/auth-activity-feeds ``` -------------------------------- ### Stream Firebase Extension: Authenticate Chat with Firebase Authentication Source: https://github.com/getstream/stream-firebase-extensions/blob/main/README.md This extension securely generates Stream Chat user tokens using Firebase Authentication and synchronizes Firebase Authentication user records with Stream Chat. It supports all Firebase Authentication methods (email/password, Google, Apple, Facebook, etc.). ```APIDOC Extension Name: Auth Chat Purpose: Authenticate users with Stream Chat via Firebase Authentication. Capabilities: - Securely generate Stream Chat user tokens using Firebase Authentication. - Synchronize Firebase Authentication user records with Stream Chat. - Support for all Firebase Authentication methods (email/password, Google, Apple, Facebook, etc.). Installation: - Via Firebase Console: https://console.firebase.google.com/project/_/extensions/install?ref=stream/auth-chat ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.