Skip to content

Conversation

1234-ad
Copy link
Contributor

@1234-ad 1234-ad commented Oct 1, 2025

Fix for Issue #10574: Include oauth2-redirect.js in npm package

Problem

The oauth2-redirect.js file was missing from the npm package distribution, causing OAuth2 authentication to fail when using the npm package. The file exists in the repository and is referenced by oauth2-redirect.html, but wasn't being packaged.

Root Cause

The .npmignore file uses a whitelist approach (excluding everything with * and then including specific files with !). It included !dist/oauth2-redirect.html but was missing !dist/oauth2-redirect.js.

Solution

Added !dist/oauth2-redirect.js to the .npmignore file whitelist.

Changes Made

  • .npmignore: Added !dist/oauth2-redirect.js to ensure the file is included in npm packages

Verification

After this fix, npm pack swagger-ui will include both:

  • dist/oauth2-redirect.html (already included)
  • dist/oauth2-redirect.js (now included)

Impact

  • Fixes OAuth2 authentication when using npm package
  • No breaking changes - purely additive
  • Maintains backward compatibility
  • Simple, targeted fix with minimal risk

Testing

The fix can be verified by:

  1. Running npm pack swagger-ui
  2. Checking that oauth2-redirect.js is now included in the package contents
  3. Confirming OAuth2 flows work properly with the npm package

This is a critical fix for OAuth2 functionality that was broken due to missing file packaging.

Fixes #10574

The oauth2-redirect.js file was missing from the npm package distribution
because it wasn't included in the .npmignore whitelist. This file is
referenced by oauth2-redirect.html and is required for OAuth2 authentication
to work properly.

Fixes swagger-api#10574
@glowcloud
Copy link
Contributor

Hi @1234-ad,

Thanks for the contribution! The fix looks good, but could you please remove the additional FIX_DOCUMENTATION file?

@1234-ad
Copy link
Contributor Author

1234-ad commented Oct 2, 2025

Hi @glowcloud,

Thanks for the feedback! I've removed the FIX_DOCUMENTATION.md file as requested. The PR now contains only the essential .npmignore fix.

The change is ready for review.

Copy link
Contributor

@glowcloud glowcloud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick update @1234-ad! LGTM now!

@glowcloud glowcloud merged commit 443c011 into swagger-api:master Oct 2, 2025
8 checks passed
swagger-bot pushed a commit that referenced this pull request Oct 2, 2025
## [5.29.2](v5.29.1...v5.29.2) (2025-10-02)

### Bug Fixes

* include oauth2-redirect.js in npm package distribution ([#10585](#10585)) ([443c011](443c011)), closes [#10574](#10574)
@swagger-bot
Copy link
Contributor

🎉 This PR is included in version 5.29.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

npm pack for 5.29.0 release does not package oauth2-redirect.js

3 participants