Skip to content

Fix installation token authentication error - #140

Merged
github-actions[bot] merged 5 commits into
mainfrom
fix/installation-token-auth-error
Oct 13, 2025
Merged

github-actions[bot] merged 5 commits into
mainfrom
fix/installation-token-auth-error

Conversation

@ishaileshpant

Copy link
Copy Markdown
Collaborator

🐛 Problem

The content submission was failing with error: [@octokit/auth-token] Token passed to createTokenAuth is not a string

🔍 Root Cause

The auth function was being passed directly to Octokit constructor instead of calling it first to get the actual installation token string.

✅ Solution

  • Call auth({ type: 'installation' }) to get the actual installation token
  • Pass the token string to Octokit constructor instead of the auth function
  • Add proper error handling for installation token retrieval

🧪 Testing

  • Fixed token authentication issue
  • Test content submission locally
  • Verify end-to-end functionality

🎯 Expected Result

Content submission should work without the Token passed to createTokenAuth is not a string error.

Fixes the issue where users get:

Content submission is temporarily unavailable. GitHub App authentication failed.
details: { githubAppError: "[@octokit/auth-token] Token passed to createTokenAuth is not a string" }

- Call auth function to get actual installation token before passing to Octokit
- Fixes '[@octokit/auth-token] Token passed to createTokenAuth is not a string' error
- Ensures proper token string is passed to Octokit constructor
- Adds proper error handling for installation token retrieval
@vercel

vercel Bot commented Oct 13, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
prepguides-dev Ready Ready Preview Comment Oct 13, 2025 5:06pm

- Pass auth function directly to Octokit instead of extracting token
- This is the correct approach for @octokit/auth-app
- Fixes JWT decoding errors when using installation tokens
- Octokit will handle token refresh automatically
- Use authStrategy parameter instead of auth parameter
- This is the correct way to use @octokit/auth-app with Octokit
- Fixes 'Token passed to createTokenAuth is not a string' error
- Octokit will properly handle the auth function as a strategy
- Use auth function directly with Octokit constructor
- This should work with @octokit/auth-app
- Let's test this approach to see if it resolves the token issue
- Get installation token directly via GitHub API
- Use token string with Octokit constructor
- Test token with direct fetch API call instead of Octokit
- This should resolve the JWT decoding errors
@ishaileshpant

Copy link
Copy Markdown
Collaborator Author

/approve

@github-actions
github-actions Bot merged commit 88cb30d into main Oct 13, 2025
11 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Admin-Approved and Auto-Merged!

This PR has been automatically merged to main after admin approval by @ishaileshpant.

✅ **Status**: Merged and deployed
🔗 **Commit**: `88cb30db97847a7f0aec1162464a52bb29aab1f4`
📅 **Merged at**: 2025-10-13T17:50:46.548Z
👤 **Approved by**: Admin/Maintainer/Owner

Thank you for your contribution! 🎉

@ishaileshpant
ishaileshpant deleted the fix/installation-token-auth-error branch October 13, 2025 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant