How to Resolve Firebase App Hosting Bad Credentials Errors

2024-11-22

How to Resolve Firebase App Hosting Bad Credentials Errors

Firebase App Hosting is currently in its public preview phase, which means it still has some stability and integration issues. One notable area of concern is its integration with GitHub, where developers might encounter various challenges. Based on my experience resolving such issues, I’ve compiled a guide to share practical solutions and insights.
Let’s dive straight into the issues and their solutions!

1. Errors Encountered

  • Permission Denied

Permission "devconnect.gitRepositoryLinks" denied on "codebase.repository"

  • Bad Credentials

Connection verification failed: unable to verify the authorization token: GET https://api.github.com/user: 401 Bad credentials []: failed precondition.

2. Step-by-Step Resolutions

2.1 Delete the App Hosting Backend

Use the Firebase CLI to delete your backend and its associated services:


delete backend.png You can find your BACKEND_ID in AppHosting console, its format is backend-id--project-id.us-central1.hosted.app.

2.2 Remove Secrets in Cloud Secret Manager

Visit the Cloud Secret Manager to remove secrets labeled with "apphosting." Make sure these secrets are not being used elsewhere in your Firebase project to avoid unexpected disruptions. google cloud secrets.png

2.3 Remove Artifacts in Artifact Registry

Navigate to the Artifact Registry in the Google Cloud Console and delete any images linked to your backend. This ensures that obsolete artifacts are no longer stored. artifactregistry.png

apphosting images.png

2.4 Remove Repository Connections in Developer Connect

Visit the Developer Connect Console to manage your repository integrations. Locate and disconnect any repositories linked to your Firebase Hosting project. This step helps resolve issues arising from misconfigured or outdated connections and ensures a clean integration environment moving forward.

developerConnectConnections.png developerConnectRepo.png

3. References


Hi, I'm Cai. I'm an indie developer exploring AI-powered startups and passionate about solving technical challenges to make development more efficient and accessible. If you're interested in discussing Firebase, AI, or startup ideas, feel free to connect with me. Let’s build smarter and innovate together! 🚀