What a SAML response is
A SAML response is the message an identity provider sends to an app after a sign-in attempt. It is defined in SAML 2.0 core as the samlp:Response element. It says whether sign-in worked and, if it did, carries one or more assertions about the user.
The app that receives it is the service provider. It reads the response at its assertion consumer service (ACS) URL. The browser carries the response from one side to the other, so the app and the identity provider never need to talk directly.
In the Web Browser SSO profile, the response travels with the HTTP-POST binding or the HTTP-Artifact binding. With POST, the identity provider returns an HTML form that the browser submits to the ACS URL. The form has a hidden field named SAMLResponse that holds the Base64-encoded XML, and often a RelayState field next to it.
What is inside a response
A response has a small envelope and the assertion inside it. Here is a shortened sample with made-up values:
<samlp:Response ID="ID_41d2" Version="2.0"
IssueInstant="2026-11-25T10:00:00Z"
Destination="https://app.example.com/saml/acs"
InResponseTo="_7f3c9a">
<saml:Issuer>https://auth.example.com/realms/acme</saml:Issuer>
<samlp:Status>
<samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success"/>
</samlp:Status>
<saml:Assertion ID="ID_9b07" Version="2.0" IssueInstant="2026-11-25T10:00:00Z">
<saml:Issuer>https://auth.example.com/realms/acme</saml:Issuer>
<ds:Signature>…</ds:Signature>
<saml:Subject>
<saml:NameID Format="urn:oasis:names:tc:SAML:2.0:nameid-format:persistent">G-5c1e…</saml:NameID>
<saml:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer">
<saml:SubjectConfirmationData Recipient="https://app.example.com/saml/acs"
NotOnOrAfter="2026-11-25T10:05:00Z" InResponseTo="_7f3c9a"/>
</saml:SubjectConfirmation>
</saml:Subject>
<saml:Conditions NotBefore="2026-11-25T10:00:00Z" NotOnOrAfter="2026-11-25T10:05:00Z">
<saml:AudienceRestriction>
<saml:Audience>https://app.example.com/saml/metadata</saml:Audience>
</saml:AudienceRestriction>
</saml:Conditions>
<saml:AuthnStatement AuthnInstant="2026-11-25T10:00:00Z" SessionIndex="3e8f">…</saml:AuthnStatement>
<saml:AttributeStatement>…</saml:AttributeStatement>
</saml:Assertion>
</samlp:Response>The envelope
Issuer: the entity id of the identity provider. From Keycloak it is the realm URL,https://<host>/realms/<realm>.Destination: the URL the response was meant for. The app should check that it equals its own ACS URL.InResponseTo: the ID of the request this answers. It is missing when the sign-in started at the identity provider.Status: a top-level code such asSuccess,RequesterorResponder, sometimes with a second-level code and a message.
The assertion
Subjectholds theNameID, the user’s identifier, and aSubjectConfirmationthat says who may present the assertion, where and until when.Conditionssets the time window and the audience: the entity id of the app the assertion is for.AuthnStatementsays when and how the user signed in, plus aSessionIndexused later for logout.AttributeStatementcarries attributes such as name, email or roles.
What this tool does
The decoder accepts the SAMLResponse value as Base64, as URL-encoded Base64, or as plain XML. It decodes it, parses it with the browser’s XML parser, and shows the parts above as readable rows, with every time shown in UTC, in your local time and relative to now.
It also tells you whether a signature element is present on the response and on each assertion, whether the assertion is encrypted, and what the status means in plain words. The decoded XML is printed with indentation so you can read the rest.
What it does not do
It does not verify the signature. Checking an XML signature needs the identity provider’s certificate, canonicalization and a careful check of which element was signed. That is the job of the app’s SAML library.
It does not decrypt an EncryptedAssertion. Only the holder of the app’s private key can do that. It does not fetch anything either: the page makes no network requests with what you paste.
How to get the response from your browser
- Open your browser’s developer tools and select the Network tab. Turn on the option to preserve the log, because the page changes during sign-in.
- Sign in to the app as usual.
- Find the POST request to the app’s ACS URL. It often ends in
/acs,/samlor/sso. - Open its payload or form data and copy the value of
SAMLResponse. - Paste it into the tool. If you copied it from the raw request body, it may be URL-encoded; the tool handles that.
A live response can sign a person in until it expires. Use a test account where you can, and do not paste responses into tools that send data to a server.
Debugging a failed login
Most SAML sign-in failures can be explained from the response alone. Read it in this order.
Check the status first
If the status is not Success, the identity provider refused, and the problem is on its side or in the request. Requester means the request was wrong. A second-level code narrows it down: InvalidNameIDPolicy means the app asked for a NameID format the identity provider will not send, and NoPassive means the app asked for a silent sign-in that was not possible. Use the SAML request decoder to read what the app asked for.
Then the audience and destination
The Audience must equal the app’s entity id, character for character. A missing trailing slash or http instead of https is enough to fail. The Destination and the Recipient must equal the ACS URL the app is listening on. When an app sits behind a proxy, it may compute its own URL wrongly and then reject a correct response.
Then the times
Compare NotBefore and NotOnOrAfter with the time the response arrived. If the window looks right but the app still says the assertion is expired or not yet valid, one of the clocks is wrong. The assertion time checker shows each limit against a time and clock skew you choose.
Then the subject and attributes
If sign-in works but the user lands in the wrong account or has no permissions, look at the NameID and the attributes. Apps often expect a specific NameID format and specific attribute names. The NameID format reference and the attribute name reference list the common ones.
Reading responses from Keycloak
When Keycloak is the identity provider, the issuer is the realm URL and the audience is the client id of the SAML client, which you set to the app’s entity id. The NameID comes from the client’s Name ID format setting, or from the format the app asked for when Force name ID format is off.
What is signed depends on two client settings. Sign documents signs the whole response. Sign assertions signs the assertion inside it. If the app checks the assertion signature and only the document is signed, the app rejects the response even though a signature is present. The decoder shows which of the two carries a signature.
Attributes come from the client’s mappers and client scopes. If an attribute the app needs is missing, add a mapper such as User Property or User Attribute and set its SAML attribute name to what the app expects. The SAML client generator builds the client settings to import.
When Keycloak is the service provider
Keycloak can also receive responses, when it brokers sign-in to another SAML identity provider. Then the response is posted to the broker endpoint of the realm, and Keycloak checks the signature, times, destination and audience before it creates or links the user. Decoding the response that reached Keycloak tells you whether the other identity provider sent what Keycloak expects.
Common errors and what they mean
| What the app reports | What to check in the response |
|---|---|
| Signature validation failed | Which element is signed, and whether the app has the current certificate of the identity provider |
| Audience mismatch or invalid audience | Audience against the app’s entity id, exactly |
| Invalid destination or recipient | Destination and Recipient against the ACS URL, including scheme, host and path |
| Assertion expired or not yet valid | NotBefore and NotOnOrAfter against the time it was used; then the clocks |
| InResponseTo does not match | Whether the sign-in started at the identity provider, or the app lost its stored request ID |
| User not found or wrong user | NameID value and format, and the attribute the app matches on |
Certificate rollover
Signature failures that start on a specific day, after months of working sign-ins, usually mean the identity provider started signing with a new key. The app still holds the old certificate. Compare the certificate in the identity provider’s current metadata with the one configured in the app. The certificate extractor prints both as PEM with fingerprints.
In Keycloak, a realm can hold more than one key. Only an active key signs; a passive key is published for verification only. Add the new key, give the app its certificate, then make the new key the one used for signing.
Security notes
- An app must check the signature on exactly the element it then reads. Libraries that do not are open to signature wrapping, where an attacker adds an unsigned assertion next to a signed one.
- An app must check audience, destination, recipient and the time limits, and must refuse a response it has already accepted once.
- Decoding is not trust. A decoded response proves nothing about who made it.
- Responses contain personal data. Treat them like logs with user data in them.
Best practices for SAML apps
- Sign assertions, and also responses if the app supports it.
- Use SHA-256 or stronger signatures. Avoid SHA-1.
- Keep clocks synced with NTP on both sides and allow only a small clock skew.
- Use a persistent NameID or a stable attribute to identify users, not an email address that can change.
- Encrypt assertions when they pass through systems you do not control, such as logging proxies.