Before you begin, ensure you have the following installed:
- Node.js and npm (Node Package Manager)
- Firebase CLI installed globally
Follow these steps to get started with the Firebase Cloud Functions:
-
Clone the Repository: Clone this repository to your local machine.
git clone https://github.com/shihabkandil/agora-token-function cd functions
-
Install Dependencies: Install the required npm dependencies.
npm install
-
Set Up Firebase Project: If you haven't already, initialize Firebase in your project and log in to your Firebase account.
firebase login
Initialize Firebase in your project (if not already initialized).
firebase init functions
Update Firebase projectId in .firebaserc
This will set up your Firebase project to deploy cloud functions.
-
Environment Configuration: Set up your environment variables. You can pass enviroment variables into your deploy command, make sure development account has Cloud Runtime Configuration API enabled.
firebase functions:secrets:set AGORA_APP_ID
firebase functions:secrets:set AGORA_CERTIFICATE
-
Run Cloud Functions Locally: Start the Firebase emulators to run functions locally.
firebase emulators:start
-
Deploy to Firebase: Deploy your function only from firebase services to Google Cloud Platform.
firebase deploy --only functions
- For more information about Firebase Cloud Functions, refer to the Firebase Documentation.