title: simplesamlphp - page keeps redirecting instead of logging in
body: <p>I am implementing single sign on using SAML for a web app using simplesamlphp, drupal as the service provider/client and WSO2 identity server as the identity provider.</p>
  <p>When I test using the simplesaml portal, I am able to retrieve the user data properly as seen in the screenshots below.</p>
  <p>On integrating it with the drupal site...</p>
  <ul>
  <li>The user gets sent to the identity provider login page for authentication.</li>
  <li>On successful authentication, they are redirected back to the app however instead of accessing the app, the user is stuck on an endless loop on a single page.</li>
  <li>Checking the SAML requests and responses / cookies, I see that the SAML responses are being sent back to the client as in the screenshots below. I also see multiple requests back and forth between IDP and SP.</li>
  </ul>
  <h3>Sample request and response</h3>
  <p><a href="https://gist.github.com/KalemaEdgar/adad5304ae98bf98d420b2c108b13307" rel="nofollow noreferrer">https://gist.github.com/KalemaEdgar/adad5304ae98bf98d420b2c108b13307</a></p>
  <p>In the screen shots below, color green is the HTTP status code and red shows the item.</p>
  <h3>Authentication request to the identity provider.</h3>
  <p><a href="https://i.stack.imgur.com/agSIL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/agSIL.png" alt="Authentication request and response to/from the identity provider" /></a></p>
  <h3>Authentication response with the data from the identity provider.</h3>
  <p><a href="https://i.stack.imgur.com/ZxmZR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZxmZR.png" alt="Authentication response with the data from the identity provider" /></a></p>
  <h3>Screenshot showing multiple redirects. Page just keeps there and SAMLRequest variable changing.</h3>
  <p><a href="https://i.stack.imgur.com/mXpNJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mXpNJ.png" alt="enter image description here" /></a></p>
  <h3>Screenshot showing the process working fine when I use the simplesaml portal.</h3>
  <p>The attributes are fetched from the WSO2 identity server</p>
  <p><a href="https://i.stack.imgur.com/sh3hU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sh3hU.png" alt="Working fine" /></a></p>