Skip to content

🚨 HOTFIX: Fix OAuth redirect_uri truncation and bot API errors - #113

Closed
ishaileshpant wants to merge 1 commit into
mainfrom
hotfix/oauth-and-bot-api-fixes
Closed

ishaileshpant wants to merge 1 commit into
mainfrom
hotfix/oauth-and-bot-api-fixes

Conversation

@ishaileshpant

Copy link
Copy Markdown
Collaborator

🚨 Critical Hotfix for Main Branch Issues

Problem

The previous PR #112 introduced two critical issues that broke the main branch:

  1. OAuth redirect_uri truncation - Users getting "redirect_uri is not associated with this application" error
  2. Bot API 500 errors - Content submission failing with "A server e... is not valid JSON" error

Root Causes

  1. OAuth URL construction was using string concatenation instead of proper URL encoding
  2. Bot API syntax errors with duplicate try-catch blocks causing server crashes

Fixes Applied

  • Fixed OAuth redirect_uri using URLSearchParams for proper encoding
  • Removed duplicate try-catch blocks in bot API
  • Added debugging logs for OAuth URL construction
  • Fixed syntax errors that caused 500 responses

Technical Changes

// Before (causing truncation)
const authUrl = `https://github.com/login/oauth/authorize?` +
    `client_id=${this.clientId}&` +
    `scope=${this.scope}&` +
    `state=${this.generateState()}&` +
    `redirect_uri=${encodeURIComponent(redirectUri)}`;

// After (proper encoding)
const params = new URLSearchParams({
    client_id: this.clientId,
    scope: this.scope,
    state: state,
    redirect_uri: redirectUri
});
const authUrl = `https://github.com/login/oauth/authorize?${params.toString()}`;

Impact

  • 🎯 Resolves OAuth authentication failures
  • 🎯 Fixes content submission bot API errors
  • 🚀 Restores full functionality to main branch
  • 🔍 Improves debugging with better logging

Testing

  • OAuth redirect_uri now properly encoded
  • Bot API syntax errors resolved
  • No linting errors
  • Proper error handling maintained

Priority: HIGH - This fixes critical issues introduced in PR #112

- Fix OAuth redirect_uri parameter using URLSearchParams for proper encoding
- Remove duplicate try-catch blocks in bot API that caused syntax errors
- Add debugging logs for OAuth URL construction
- Resolves 'redirect_uri is not associated with this application' error
- Fixes 500 Internal Server Error in content submission bot API

Issues fixed:
1. OAuth redirect_uri was being truncated due to improper URL construction
2. Bot API had syntax errors with duplicate catch blocks
3. Content submission was failing with 'A server e... is not valid JSON' error
@vercel

vercel Bot commented Oct 8, 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 8, 2025 6:31pm

@ishaileshpant

Copy link
Copy Markdown
Collaborator Author

/approve

@github-actions

github-actions Bot commented Oct 8, 2025

Copy link
Copy Markdown
Contributor

Admin Approval Rejected

This PR cannot be approved because it doesn't follow the naming convention.

**Requirements:**
- Branch must start with: `feature/`, `fix/`, `docs/`, `improve/`, or `security/`

**Current Branch**: `hotfix/oauth-and-bot-api-fixes`

Please ensure your PR follows the naming convention before approval.

@ishaileshpant

Copy link
Copy Markdown
Collaborator Author

Closing this PR due to incorrect branch naming convention. The branch 'hotfix/oauth-and-bot-api-fixes' doesn't follow the required naming convention. A new PR has been created with the correct 'fix/' prefix.

@ishaileshpant
ishaileshpant deleted the hotfix/oauth-and-bot-api-fixes 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