apac-ops-bot/frontend
SamoilenkoVadym c5b17b2bb2 Add try-catch for MSAL initialization and validate tenant ID
Problem:
- MSAL was throwing runtime errors when Azure credentials were incomplete
- Script error in browser due to invalid MSAL configuration
- PublicClientApplication constructor failing with empty/undefined values

Solution:
- Added tenant ID validation in addition to client ID check
- Wrapped MSAL initialization in try-catch to handle configuration errors gracefully
- Log warning instead of crashing when MSAL cannot be initialized
- Allow application to continue with simple login when Azure is not configured

Changes:
- Check both REACT_APP_AZURE_CLIENT_ID and REACT_APP_AZURE_TENANT_ID
- Use try-catch when creating PublicClientApplication instance
- Set msalInstance to null on initialization failure
- Console warning for debugging when Azure AD is not properly configured

This prevents runtime errors and allows the application to work in test mode
without requiring valid Azure AD configuration.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-28 11:01:37 +00:00
..
public Add comprehensive backend test suite and Phase 1 foundation 2026-01-27 14:24:59 +00:00
src Add try-catch for MSAL initialization and validate tenant ID 2026-01-28 11:01:37 +00:00
.env.example Add comprehensive backend test suite and Phase 1 foundation 2026-01-27 14:24:59 +00:00
Dockerfile Fix crypto error by disabling MSAL when Azure AD is not configured 2026-01-28 10:56:54 +00:00
package-lock.json Fix crypto error by disabling MSAL when Azure AD is not configured 2026-01-28 10:56:54 +00:00
package.json Fix crypto error by disabling MSAL when Azure AD is not configured 2026-01-28 10:56:54 +00:00
tsconfig.json Add comprehensive backend test suite and Phase 1 foundation 2026-01-27 14:24:59 +00:00