<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Google workspace SAML v2: both IdP initiated &amp; SP initiated logins]]></title><description><![CDATA[<p dir="auto">FusionAuth version: 1.47.1 (hosted version, Starter license).</p>
<p dir="auto">I'm trying to get a SAML v2 identity provider set up against Google Workspace that allows both SP initiated and IdP initiated logins. [1] I'm struggling with how to configure this though.</p>
<p dir="auto">Here's my basic setup:</p>
<ol>
<li>
<p dir="auto">I have a callback URL in my application where I do the code -&gt; token exchange after authentication:</p>
<p dir="auto"><a href="https://dashboard.stablebuild.com/callbacks/fusionauth?url=%2Forganizations%2Fstablebuild" rel="nofollow ugc">https://dashboard.stablebuild.com/callbacks/fusionauth?url=%2Forganizations%2Fstablebuild</a></p>
<p dir="auto">FusionAuth then appends <code>&amp;code=xxxx</code> to this.</p>
</li>
<li>
<p dir="auto">When I do SP initiated login I redirect to (where idp_hint is the IdP ID):</p>
<p dir="auto"><a href="https://stablebuild.fusionauth.io/oauth2/authorize?client_id=1c165b4b-ef9a-4fe7-bde9-89ea0498432e&amp;response_type=code&amp;redirect_uri=https%3A%2F%2Fdashboard.stablebuild.com%2Fcallbacks%2Ffusionauth%3Furl%3D%252Forganizations%252Fstablebuild&amp;idp_hint=5f06463b-97ae-4f93-b925-18d8ef9751a7" rel="nofollow ugc">https://stablebuild.fusionauth.io/oauth2/authorize?client_id=1c165b4b-ef9a-4fe7-bde9-89ea0498432e&amp;response_type=code&amp;redirect_uri=https%3A%2F%2Fdashboard.stablebuild.com%2Fcallbacks%2Ffusionauth%3Furl%3D%252Forganizations%252Fstablebuild&amp;idp_hint=5f06463b-97ae-4f93-b925-18d8ef9751a7</a></p>
</li>
</ol>
<p dir="auto">I have two ACS callback URLs in the identity provider config in FusionAuth:</p>
<ul>
<li>Callback URL (ACS): <a href="https://stablebuild.fusionauth.io/samlv2/acs" rel="nofollow ugc">https://stablebuild.fusionauth.io/samlv2/acs</a></li>
<li>IdP Initiated Callback URL (ACS): <a href="https://stablebuild.fusionauth.io/samlv2/acs/5f06463b-97ae-4f93-b925-18d8ef9751a7/1c165b4b-ef9a-4fe7-bde9-89ea0498432e" rel="nofollow ugc">https://stablebuild.fusionauth.io/samlv2/acs/5f06463b-97ae-4f93-b925-18d8ef9751a7/1c165b4b-ef9a-4fe7-bde9-89ea0498432e</a></li>
</ul>
<h4>Try 1: Using the ACS callback URL</h4>
<p dir="auto">When I configure the first URL as the callback URL in Google Workspace:</p>
<p dir="auto"><img src="/community/forum/assets/uploads/files/1699451625200-605c57e1-50da-4957-9fde-9e5d5b17c9e7-image.png" alt="605c57e1-50da-4957-9fde-9e5d5b17c9e7-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Then:</p>
<ol>
<li>
<p dir="auto">SP initiated login works</p>
</li>
<li>
<p dir="auto">IdP initiated login redirects to:</p>
<p dir="auto"><a href="https://stablebuild.fusionauth.io/oauth2/authorize?tenantId=7c4f6470-a023-d2e5-728c-3e5137f089bb" rel="nofollow ugc">https://stablebuild.fusionauth.io/oauth2/authorize?tenantId=7c4f6470-a023-d2e5-728c-3e5137f089bb</a></p>
<p dir="auto">And fails with 'The request is missing a required parameter: redirect_uri'</p>
</li>
</ol>
<h4>Try 2: Using the ACS callback URL w/ Start URL</h4>
<p dir="auto">Google describes the Start URL as "This is used to set the RelayState parameter in a SAML Request, which can be a URL to redirect to after authentication.". If I set the Start URL to my redirect URL:</p>
<p dir="auto"><img src="/community/forum/assets/uploads/files/1699452051851-47bf4c16-d1e5-42d7-bcd5-57d9e4b060c7-image.png" alt="47bf4c16-d1e5-42d7-bcd5-57d9e4b060c7-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Then:</p>
<ol>
<li>
<p dir="auto">SP initiated login works</p>
</li>
<li>
<p dir="auto">IdP initiated login redirects to:</p>
<p dir="auto"><a href="https://stablebuild.fusionauth.io/oauth2/authorize?state=https%3A%2F%2Fdashboard.stablebuild.com%2Fcallbacks%2Ffusionauth%3Furl%3D%252Forganizations%252Fstablebuild&amp;tenantId=7c4f6470-a023-d2e5-728c-3e5137f089bb" rel="nofollow ugc">https://stablebuild.fusionauth.io/oauth2/authorize?state=https%3A%2F%2Fdashboard.stablebuild.com%2Fcallbacks%2Ffusionauth%3Furl%3D%252Forganizations%252Fstablebuild&amp;tenantId=7c4f6470-a023-d2e5-728c-3e5137f089bb</a></p>
<p dir="auto">and still fails with 'the request is missing a required parameter: redirect_uri' - makes sense, the URL is passed in the <code>state</code> field, not in the <code>redirect_uri</code> field.</p>
</li>
</ol>
<h4>Try 3: Using the ACS callback URL by appending ?redirect_uri</h4>
<p dir="auto">According to <a href="https://github.com/FusionAuth/fusionauth-issues/issues/1785" rel="nofollow ugc">https://github.com/FusionAuth/fusionauth-issues/issues/1785</a> the RelayState parameter is indeed not supported, but we should be able to append <code>?redirect_uri</code> to the callback URL. Here I append the callback URL (previously in Start URL to the ACS URL):</p>
<p dir="auto"><img src="/community/forum/assets/uploads/files/1699452238195-fff5bff4-87e9-4b66-a3ae-c9d418c795d9-image.png" alt="fff5bff4-87e9-4b66-a3ae-c9d418c795d9-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Then:</p>
<ol>
<li>
<p dir="auto">SP initiated login fails with:</p>
<p dir="auto">"The SAML AuthnResponse status indicated the request has failed. Unable to complete this login request."</p>
<p dir="auto">And in the logs I see:</p>
<pre><code>&lt;saml2p:StatusMessage&gt;Invalid request, ACS Url in request https://stablebuild.fusionauth.io/samlv2/acs doesn't match configured ACS Url https://stablebuild.fusionauth.io/samlv2/acs/?redirect_uri=https%3A%2F%2Fdashboard.stablebuild.com%2Fcallbacks%2Ffusionauth%3Furl%3D%252Forganizations%252Fstablebuild.&lt;/saml2p:StatusMessage&gt;
</code></pre>
<p dir="auto">So that won't work.</p>
</li>
<li>
<p dir="auto">IdP initiated login redirects to:</p>
<p dir="auto"><a href="https://stablebuild.fusionauth.io/oauth2/authorize?redirect_uri=https%3A%2F%2Fdashboard.stablebuild.com%2Fcallbacks%2Ffusionauth%3Furl%3D%252Forganizations%252Fstablebuild&amp;tenantId=7c4f6470-a023-d2e5-728c-3e5137f089bb" rel="nofollow ugc">https://stablebuild.fusionauth.io/oauth2/authorize?redirect_uri=https%3A%2F%2Fdashboard.stablebuild.com%2Fcallbacks%2Ffusionauth%3Furl%3D%252Forganizations%252Fstablebuild&amp;tenantId=7c4f6470-a023-d2e5-728c-3e5137f089bb</a></p>
<p dir="auto">and fails with 'The request is missing a required parameter: client_id'. So it picks up the redirect_uri at least.</p>
</li>
</ol>
<p dir="auto">So, it seems that we can append the right parameters to the URL maybe - but SP initiated login breaks whenever we do that.</p>
<h4>Try 4: Using the IdP Initiated Callback URL w/ ?redirect_uri param</h4>
<p dir="auto">When I set the IdP initiated callback URL, with the ?redirect_uri parameter set:</p>
<p dir="auto"><img src="/community/forum/assets/uploads/files/1699452630151-ee8734c4-b8a0-4a95-a90e-30d84f1b7d0f-image.png" alt="ee8734c4-b8a0-4a95-a90e-30d84f1b7d0f-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">(Here ACS URL is <a href="https://stablebuild.fusionauth.io/samlv2/acs/5f06463b-97ae-4f93-b925-18d8ef9751a7/1c165b4b-ef9a-4fe7-bde9-89ea0498432e?redirect_uri=https%3A%2F%2Fdashboard.stablebuild.com%2Fcallbacks%2Ffusionauth%3Furl%3D%252Forganizations%252Fstablebuild" rel="nofollow ugc">https://stablebuild.fusionauth.io/samlv2/acs/5f06463b-97ae-4f93-b925-18d8ef9751a7/1c165b4b-ef9a-4fe7-bde9-89ea0498432e?redirect_uri=https%3A%2F%2Fdashboard.stablebuild.com%2Fcallbacks%2Ffusionauth%3Furl%3D%252Forganizations%252Fstablebuild</a>)</p>
<p dir="auto">Then:</p>
<ol>
<li>
<p dir="auto">SP initiated login fails with:</p>
<pre><code>Invalid redirect_uri Y2xpZW50X2lkPTFjMTY1YjRiLWVmOWEtNGZlNy1iZGU5LTg5ZWEwNDk4NDMyZSZyZWRpcmVjdF91cmk9aHR0cHMlM0ElMkYlMkZkYXNoYm9hcmQuc3RhYmxlYnVpbGQuY29tJTJGY2FsbGJhY2tzJTJGZnVzaW9uYXV0aCUzRnVybCUzRCUyNTJGb3JnYW5pemF0aW9ucyUyNTJGc3RhYmxlYnVpbGQmcmVzcG9uc2VfdHlwZT1jb2RlJnRlbmFudElkPTdjNGY2NDcwLWEwMjMtZDJlNS03MjhjLTNlNTEzN2YwODliYiZpZGVudGl0eVByb3ZpZGVySWQ9NWYwNjQ2M2ItOTdhZS00ZjkzLWI5MjUtMThkOGVmOTc1MWE3JmNzcmY9b1gzLVQxTzVEcVJ4NVpKVg
</code></pre>
<p dir="auto">Which is base64 encoded:</p>
<pre><code>client_id=1c165b4b-ef9a-4fe7-bde9-89ea0498432e&amp;redirect_uri=https%3A%2F%2Fdashboard.stablebuild.com%2Fcallbacks%2Ffusionauth%3Furl%3D%252Forganizations%252Fstablebuild&amp;response_type=code&amp;tenantId=7c4f6470-a023-d2e5-728c-3e5137f089bb&amp;identityProviderId=5f06463b-97ae-4f93-b925-18d8ef9751a7&amp;csrf=oX3-T1O5DqRx5ZJV
</code></pre>
<p dir="auto">Which looks like valid query params; but for some reason they are base64 encoded, and interpreted as just the redirect_uri.</p>
</li>
<li>
<p dir="auto">IdP initiated login works.</p>
</li>
</ol>
<h4>So... ?</h4>
<p dir="auto">I'm unsure how to proceed. I think that:</p>
<ul>
<li>If using the RelayState parameter as the redirect URI would be supported then I guess all of this would just work out of the box (filed on GH here: I've filed <a href="https://github.com/FusionAuth/fusionauth-issues/issues/2545" rel="nofollow ugc">https://github.com/FusionAuth/fusionauth-issues/issues/2545</a> as a feature request to support using the RelayState as the redirect URL.).</li>
<li>Appending ?redirect_uri, as suggested in <a href="https://github.com/FusionAuth/fusionauth-issues/issues/1785" rel="nofollow ugc">https://github.com/FusionAuth/fusionauth-issues/issues/1785</a>  does not work for SP initiated logins (bug? feature?).</li>
<li>Something gets interpreted as base64 that shouldn't when using the IdP Initiated Callback URL with an SP-initiated flow (or I'm just abusing the endpoint, and this should never be possible - but maybe this should error out with a better message).</li>
</ul>
<p dir="auto">Any suggestions?</p>
<hr />
<p dir="auto">[1]I'd assume this is a relatively common usecase, as I want to trigger an auth flow from my application (SP initiated), as well as have a button in the Google Workspace app drawer to go to the application (IdP initiated) - if I have this wrong then I'd be happy to hear that too.</p>
]]></description><link>https://fusionauth.io/community/forum/topic/2551/google-workspace-saml-v2-both-idp-initiated-sp-initiated-logins</link><generator>RSS for Node</generator><lastBuildDate>Tue, 16 Jun 2026 11:39:03 GMT</lastBuildDate><atom:link href="https://fusionauth.io/community/forum/topic/2551.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 08 Nov 2023 14:26:00 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Google workspace SAML v2: both IdP initiated &amp; SP initiated logins on Wed, 15 Nov 2023 17:31:34 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://fusionauth.io/community/forum/uid/2719">@jan-1</a> , unfortunately I don't have a great suggestion for you.  It looks like <a class="mention plugin-mentions-user plugin-mentions-a" href="https://fusionauth.io/community/forum/uid/3">@robotdan</a> is taking a look at the issue you created.  I will follow the issue and check back in, once they update it.</p>
]]></description><link>https://fusionauth.io/community/forum/post/6785</link><guid isPermaLink="true">https://fusionauth.io/community/forum/post/6785</guid><dc:creator><![CDATA[mark.robustelli]]></dc:creator><pubDate>Wed, 15 Nov 2023 17:31:34 GMT</pubDate></item></channel></rss>