Firebase Setup
Firebase Setup
GO Shortener integrates with Firebase Authentication to enable Google OAuth sign-in. Follow this step-by-step guide to configure your Firebase project and connect it to your GO instance.
Step 1: Create a Firebase Project
1. Open Firebase Console
Navigate to the Firebase Console and sign in with your Google account.
2. Add New Project
Click Add project (or Create a project).
- Enter a project name (e.g.,
go-shortener-auth). - Google Analytics is optional; you can disable it if not needed.
- Click Create project and wait for provisioning to complete.
Step 2: Register a Web App
1. Add Web App
On your Firebase Project Overview dashboard, click the Web icon (</>) to register a new web application.
2. App Nickname
Enter an app nickname (e.g., GO Web Client). Leave Firebase Hosting unchecked unless you plan to use it. Click Register app.
3. Obtain Client Configuration
Firebase will display a firebaseConfig snippet containing your keys:
const firebaseConfig = {
apiKey: "AIzaSy...",
authDomain: "go-shortener-auth.firebaseapp.com",
projectId: "go-shortener-auth",
storageBucket: "go-shortener-auth.firebasestorage.app",
messagingSenderId: "123456789012",
appId: "1:123456789012:web:abcdef123456"
};
Keep this window open or copy the values into a temporary scratchpad.
Step 3: Enable Authentication Providers
1. Access Authentication
In the left sidebar of the Firebase Console, navigate to Build > Authentication, then click Get started.
2. Enable Google Sign-In
In the Sign-in method tab:
- Click Google under the list of additional providers.
- Toggle the switch to Enable.
- Select your support email address from the dropdown.
- Click Save.
Step 4: Configure Authorized Domains
1. Open Authorized Domains
In the Authentication section, click the Settings tab and select Authorized domains.
2. Add Your Production Domains
By default, localhost is authorized. Click Add domain and enter your production hostname:
go.arcn.online- (Optional) Any custom staging or reverse proxy domains.
Step 5: Configure GO Shortener Environment Variables
Populate your server's /root/Go-shortner/.env file with the client credentials collected from Step 2:
# Firebase Web App Credentials
FIREBASE_API_KEY=your_firebase_api_key_here
FIREBASE_AUTH_DOMAIN=your-project-id.firebaseapp.com
FIREBASE_PROJECT_ID=your-project-id
FIREBASE_STORAGE_BUCKET=your-project-id.firebasestorage.app
FIREBASE_MESSAGING_SENDER_ID=your_messaging_sender_id
FIREBASE_APP_ID=your_firebase_app_id
GET /api/auth/firebase-config endpoint. You do not need to rebuild the binary when updating Firebase parameters.Restart the GO service to activate Google authentication:
systemctl restart go-shortener