Fix Microsoft Entra ID HTTPS Redirect URL Authentication Error in Java
Question details
The user needs to resolve an authentication error where a Java Spring Boot application fails with invalid credentials when using an HTTPS redirect URL with Microsoft Entra ID, despite working over HTTP.

- Product
- Microsoft Entra ID / Java Spring Boot
- Device & OS
- not provided
- Scenario
- Configuring OAuth2 authentication for a Java Spring Boot application integrated with Microsoft Entra ID.
- Observed behavior
- The application authenticates successfully over HTTP but returns invalid credential errors when switched to an HTTPS redirect URL.
Ensure you have administrator access to your Microsoft Entra ID portal and the source code for your Java Spring Boot application's security configurations.
Configure Spring Boot Headers and Verify Entra ID Redirect URIs
The most common cause for this error is a mismatch between the HTTPS redirect URI registered in Azure and how Spring Boot handles reverse proxy HTTPS headers.
When running behind a reverse proxy or load balancer, Spring Boot might default to constructing HTTP redirect URIs unless explicitly told to trust forwarded HTTPS headers. Additionally, Microsoft Entra ID requires an exact match for the registered HTTPS redirect URL.
Log in to the Microsoft Entra admin center. Navigate to 'App registrations', select your application, click on 'Authentication' in the left menu, and ensure the exact HTTPS redirect URI is listed.
Open your application.properties or application.yml file. Add the configuration property 'server.forward-headers-strategy=framework' to ensure Spring Boot processes the X-Forwarded-Proto headers correctly and constructs HTTPS URLs.
Restart your Java Spring Boot application and attempt the OAuth2 login flow again using the HTTPS URL to verify that the invalid credential error is resolved.

Seek Assistance on Microsoft Q&A Forums
If configuration checks do not resolve the error, consult the official Microsoft developer community for advanced Azure Active Directory troubleshooting.
Document Your Application Architecture with WPS Office
Troubleshooting OAuth2 configurations often requires drafting API specs, security policies, or developer notes. WPS Office offers a free, lightweight, and highly compatible alternative to Microsoft Office for creating professional developer documentation.
- 1. Download the Installer: Visit the official WPS Office website and download the free version for your operating system.
- 2. Install WPS Office: Run the downloaded installer and follow the on-screen prompts to complete the setup.
- 3. Start Documenting: Open WPS Writer to begin drafting your Spring Boot and Microsoft Entra ID configuration guides.

Frequently Asked Questions
Why does my Spring Boot OAuth2 redirect to HTTP instead of HTTPS?
This commonly occurs when the application runs behind a reverse proxy or load balancer. Spring Boot needs the 'server.forward-headers-strategy=framework' property to recognize the 'X-Forwarded-Proto' header and generate HTTPS redirect URIs.
Where do I register the HTTPS redirect URL in Microsoft Entra ID?
Navigate to the Microsoft Entra admin center, go to 'App registrations', select your specific application, and add the HTTPS URL under the 'Authentication' > 'Redirect URIs' section.
What information should I include when asking for help on Microsoft Q&A?
Always include your sanitized redirect URI, relevant Spring Security configuration snippets, the exact error message, and be sure to tag the post with 'Azure Active Directory' or 'Microsoft Graph' for maximum visibility among experts.




