logo
search
Others

Fix Microsoft Entra ID HTTPS Redirect URL Authentication Error in Java

Huda QurayshiHuda Qurayshi Oct 12, 2026 868 views

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.

Fix Microsoft Entra ID HTTPS Redirect URL Authentication Error
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.
Before you start

Ensure you have administrator access to your Microsoft Entra ID portal and the source code for your Java Spring Boot application's security configurations.

Solution 1Recommended

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.

1
Verify Redirect URI in Entra ID

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.

2
Enable Forward Headers in Spring Boot

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.

3
Test Authentication Flow

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.

Configure Spring Boot Headers and Verify Entra ID Redirect URIs
Proxy Configuration: If you are using a proxy server, ensure it is properly configured to pass the 'X-Forwarded-Proto: https' header to your backend Java application.
Free Microsoft Office alternative

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. 1. Download the Installer: Visit the official WPS Office website and download the free version for your operating system.
  2. 2. Install WPS Office: Run the downloaded installer and follow the on-screen prompts to complete the setup.
  3. 3. Start Documenting: Open WPS Writer to begin drafting your Spring Boot and Microsoft Entra ID configuration guides.
Free and lightweight office suite for developersHigh compatibility with Microsoft Word, Excel, and PowerPoint formatsPerfect for drafting API documentation and application security guidesBuilt-in PDF tools for sharing configuration manuals securely
microsoft office alternative - wps office

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.