You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I write a guide detailing how to connect your website to a SAML identity provider using FusionAuth as a service provider (FusionAuth/fusionauth-site#2854). I want to use FusionAuth as the identity provider to avoid using a competitor like Dex or Keycloak in the example.
But after everything is set up, the SAML login page returns the error "message" : "OAuth return is missing the authorization code and/or the SAML encoded state.".
Below is my docker compose file. I use the host network to ensure that the error can't be caused by conflicts between localhost and fa container names differing between URLs in the browser and URLs in the server-to-server calls in the SAML protocol.
Container fa on port 9011 is the identity provider instance, and container fa2 on port 9021 is the service provider instance the website connects to.
SAML v2 IdP AuthN Request Debug Log for [fa] [62f98e0d-3272-4ad3-9ac2-e54f14ecb892]
1/23/2025 10:59:34 AM Z Build the AuthN SAML v2 request.
1/23/2025 10:59:34 AM Z Begin AuthN request by calling /api/identity-provider/start to register a SAML v2 request Id.
1/23/2025 10:59:34 AM Z Start request returned request Id [idb7db4547a0874f76958ad33687243be4]
1/23/2025 10:59:34 AM Z AuthN request being sent to the identity provider.
1/23/2025 10:59:34 AM Z http://localhost:9011/samlv2/login/d7d09513-a3f5-401c-9685-34ab6c552453
1/23/2025 10:59:34 AM Z Binding: urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect
1/23/2025 10:59:34 AM Z Query string: SAMLRequest=fZLdatwwEIVfxajXtmRJXtvCdlgSAgtpKfm76J1WlncNsrTVyOvm7StvmwYK2dvhzDkz30xz82syyVl7GJ1tUZ4RlGirXD%2FaQ4tenu%2FTCiUQpO2lcVa36E0DuukaC0xs53C0j%2FrnrCEk0cZCi2ZvhZMwgrBy0iCCEk%2Fbrw%2BCZkRIAO1DzEF%2F1MICbdExhJPAeFmWbGGZ8wdMCSGY1DiKehgPXz7k7HrAybvglDMfDfwT%2FxwTvvrHVaP99n2wW2dhnrR%2F0v48Kv3y%2BPCv3zglzdFBEDWhOQY5mTPFUgFKdnctGvt92e95wUtJqpIP5aYuKtkzt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UTF-8"?><ns3:AuthnRequest xmlns:ns3="urn:oasis:names:tc:SAML:2.0:protocol" xmlns="urn:oasis:names:tc:SAML:2.0:assertion" xmlns:ns2="http://www.w3.org/2000/09/xmldsig#" xmlns:ns4="http://www.w3.org/2001/04/xmlenc#" AssertionConsumerServiceURL="http://localhost:9021/samlv2/acs" ID="idb7db4547a0874f76958ad33687243be4" Version="2.0" IssueInstant="2025-01-23T10:59:34.834Z">
<Issuer>http://localhost:9021/samlv2/sp/62f98e0d-3272-4ad3-9ac2-e54f14ecb892</Issuer>
<ns3:NameIDPolicy Format="urn:oasis:names:tc:SAML:2.0:nameid-format:persistent" AllowCreate="false"/>
</ns3:AuthnRequest>
Version
1.54.0
Affects Versions
No response
The text was updated successfully, but these errors were encountered:
Using Okta as the Idp works fine, so I'll use that in the guide. When this FusionAuth bug is fixed I'll update the guide to make it easier to complete without needing a whole 3rd party web app with mobile authentication codes.
What happened?
Error
I write a guide detailing how to connect your website to a SAML identity provider using FusionAuth as a service provider (FusionAuth/fusionauth-site#2854). I want to use FusionAuth as the identity provider to avoid using a competitor like Dex or Keycloak in the example.
But after everything is set up, the SAML login page returns the error
"message" : "OAuth return is missing the authorization code and/or the SAML encoded state."
.I've used FusionAuth as an IdP before for a website, so I know that works, but there seems to be a bug using FusionAuth as a SP connecting to FusionAuth. I've read the documentation https://fusionauth.io/docs/lifecycle/authenticate-users/identity-providers/overview-samlv2 and can't find anything I'm missing.
Details below.
Docker compose file
Below is my docker compose file. I use the host network to ensure that the error can't be caused by conflicts between
localhost
andfa
container names differing between URLs in the browser and URLs in the server-to-server calls in the SAML protocol.Container
fa
on port 9011 is the identity provider instance, and containerfa2
on port 9021 is the service provider instance the website connects to.The env and kickstart files come from the standard quickstart: https://github.com/fusionauth/fusionauth-example-docker-compose/blob/main/light/kickstart/kickstart.json
Setup instructions
docker compose up
http://localhost:9021/samlv2/sp/62f98e0d-3272-4ad3-9ac2-e54f14ecb892
http://localhost:9021/samlv2/acs
debug enabled
fa
- paste value from previous stepenabled
62f98e0d-3272-4ad3-9ac2-e54f14ecb892
fa
fa
http://localhost:9011/samlv2/login/d7d09513-a3f5-401c-9685-34ab6c552453
login with saml
Error:
"message" : "OAuth return is missing the authorization code and/or the SAML encoded state."
URL:
http://localhost:9011/samlv2/callback/d7d09513-a3f5-401c-9685-34ab6c552453?error=invalid_request&error_reason=invalid_origin&error_description=Invalid+origin+uri+http%3A%2F%2Flocalhost%3A9021&state=eyJ...
Event log from IdP:
Event log from SP:
Version
1.54.0
Affects Versions
No response
The text was updated successfully, but these errors were encountered: