Back

Failed to retrieve access token from GitHub API - self-hosting - ngrok - localhost

  • 0
  • Self Hosted
  • Functions
  • Auth
Tomek
8 Jan, 2025, 01:09

Hi,

I have problem to connect to github repository. I make configuration based on docs: https://appwrite.io/docs/advanced/self-hosting/functions I tested it on 1.6.0, and 1.6.1-RC1 and i still have the same error:

Error in logs: Message: Failed to retrieve access token from GitHub API.

My configuration:

TypeScript
_APP_DOMAIN=feasible-hookworm-adapting.ngrok-free.app
_APP_DOMAIN_FUNCTIONS=functions.feasible-hookworm-adapting.ngrok-free.app
_APP_DOMAIN_TARGET=feasible-hookworm-adapting.ngrok-free.app

_APP_VCS_GITHUB_APP_NAME=app-write-local
_APP_VCS_GITHUB_PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----\nMIIE[...]3iwA==\n-----END RSA PRIVATE KEY-----"
_APP_VCS_GITHUB_APP_ID=1105293
_APP_VCS_GITHUB_CLIENT_ID=Iv23lioIKnUDBoqxWXhy
_APP_VCS_GITHUB_CLIENT_SECRET=e31eea9bdd1914f867638303aea20091478690b1
_APP_VCS_GITHUB_WEBHOOK_SECRET=tomasztoja

Appwrite is running on docker, and the instance is available public by Ngrok: https://feasible-hookworm-adapting.ngrok-free.app -> http://localhost:8091

GitHub App configuration:

order of callback url:

https://feasible-hookworm-adapting.ngrok-free.app/v1/vcs/github/callback https://feasible-hookworm-adapting.ngrok-free.app/v1/account/sessions/oauth2/callback/github/console

[Selected] Request user authorization (OAuth) during installation

Webhook URL: https://feasible-hookworm-adapting.ngrok-free.app/v1/vcs/github/events

Permission is granted.

please give me some tips to fix it πŸ™‚

TL;DR
Developers are having trouble connecting to a GitHub repository while self-hosting Appwrite with Ngrok. They are receiving an error message: `Failed to retrieve access token from GitHub API.` The error persists despite trying different versions. They have provided their configuration details. **Solution:** This issue may be related to the callback URLs configuration in the GitHub App. Developers should verify the correct order of callback URLs, ensure that user authorization during installation is requested, and check the webhook URL permissions.
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more