Skip to content

Add retry limit to OAuth username generation loops#55

Merged
YoungMame merged 4 commits into
27-add-omniauth-strategies-for-user-authenticationfrom
copilot/sub-pr-54
Nov 26, 2025
Merged

Add retry limit to OAuth username generation loops#55
YoungMame merged 4 commits into
27-add-omniauth-strategies-for-user-authenticationfrom
copilot/sub-pr-54

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Nov 26, 2025

The username generation loop in OAuth strategies (42, Facebook) had no upper bound, creating a potential infinite loop if all username variations were taken.

Changes:

  • Add MAX_USERNAME_RETRIES = 10 constant at module level in both 42.ts and facebook.ts
  • Return 500 error with clear message if unique username cannot be generated after max retries
  • Update .gitignore to exclude TypeScript build artifacts (.d.ts, .d.ts.map, .js.map)
const MAX_USERNAME_RETRIES = 10;

// In callback handler:
let retryCount = 0;
while (isUsernameTaken) {
    if (retryCount >= MAX_USERNAME_RETRIES) {
        return reply.status(500).send({ error: 'Failed to generate unique username after maximum retries' });
    }
    // ... username generation logic
    retryCount++;
}

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits November 26, 2025 12:20
…finite loop

Co-authored-by: YoungMame <134452452+YoungMame@users.noreply.github.com>
Co-authored-by: YoungMame <134452452+YoungMame@users.noreply.github.com>
@YoungMame YoungMame marked this pull request as ready for review November 26, 2025 12:22
Copilot AI changed the title [WIP] Update omniauth strategies for user authentication based on feedback Add retry limit to OAuth username generation loops Nov 26, 2025
Copilot AI requested a review from YoungMame November 26, 2025 12:24
Added environment variables for Facebook and FT clients.
@YoungMame YoungMame merged commit b0d462f into 27-add-omniauth-strategies-for-user-authentication Nov 26, 2025
1 check passed
@YoungMame YoungMame deleted the copilot/sub-pr-54 branch November 26, 2025 12:27
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.

2 participants