Skip to main content
kaman
Staff
Staff
May 22, 2026

Troubleshooting Tip: 'Invalid Request' error encountered during SAML SSO login with Keycloak

  • May 22, 2026
  • 0 replies
  • 262 views

Description

This article explains the possible causes of the 'Invalid Request' error encountered during SSL VPN connections using SAML authentication with Keycloak as the Identity Provider (IdP).

Scope

FortiGate.

Solution

While connecting to the SSL VPN using FortiClient with SAML authentication with Keycloak IDP, the error 'Invalid Request' appears, as shown in the image below:

5c353782.png


Web mode was enabled for testing purposes, and the same error was observed there as well.

1ea9274e.png


This issue may occur if the SAML configuration on the FortiGate is incorrect. The configuration can be verified by reviewing the debug logs from the FortiGate CLI session.


diagnose debug application sslvpn -1
diagnose debug application samld -1
diagnose debug console timestamp enable
diagnose debug enable <----- Starts the debugging.
diagnose debug reset
diagnose debug disable 


The first thing to verify is that the 'config user saml' settings are correctly configured.

b750a7d7.png


In this case, the issue appears to be related to the attribute configuration and certificate. Configure username as 'username' and group-name as 'group' under 'config user saml'

In Keycloak, navigate to the Keys tab under Realm Settings, download the default RSA certificate used for signing the IdP responses, and import the certificate into the FortiGate.

The certificate was imported into the FortiGate Identity Provider configuration under Single Sign-On, but the same error persists.

In this case, two possible solutions are available. One workaround is to navigate to the 'Settings' section of the client configuration in Keycloak and disable 'Client Signature Required'.

4d71ab50.png


If the Keycloak team prefers not to disable 'Client Signature Required', enable the 'require-signed-resp-and-asrt' option under config user saml in FortiGate.

Then, enable the 'Fortinet_Factory' certificate in the Service Provider configuration under 'Single Sign-On' on the FortiGate, and import the certificate into Keycloak. Afterwards, the issue is resolved, and access to the Keycloak page is successful.

bea6a0f5.png

    Thought Leadership Security Summit. Outpace New Threats with AI - enhanced defense. Tuesday, Septmeber 15, 8:30 AM - 2:30 PM PT. The Golf Club at Newcastle, WA.
    Fortinet Flag the Hack. Wednesday, August 26, 9:00 AM - 5:00 PM ET, COSM, Atlanta, GA.
    Virtual event | September 2026. SASE summit. The age of autonomous trust. Register here!