Replies: 1 comment
-
Ok so the CORS part of my issue seems obvious to me now. However how do I tell Blazor wasm, that when it receives a 302 from the server, it should do a full redirect to that URL rather than a fetch? I think this probably warrants a specific blazor issue opening at this point |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I was experimenting with adding SAML authentication to my blazor wasm application.
To initiate a login, the blazor wasm app sends POST request to it's web api (asp.net core, hosted on same origin), which issues a challenge, causes a SAML authentication handler to run (open source by sustainsys) which returns the following 303 result which is a redirect to the SAML IDP (Azure AD) containing the SAML payload (I have replaced some sensitive values with asterix)
However back in blazor world, having just made that POST request with HttpClient, I don't get back the above response, because it seems the a higher level api (perhaps the browser fetch api, or something the http client does) handles the redirect and issues another request automatically. This is where the problem is. The next thing I see in the browser console window are these:
and finally, a "failed to fetch" exception is raised to me in blazor world.
Side note:
In the network tab it actually appears as if it issues the request to the redirected location twice - and the network tab only shows one failure:
The purpose of this discussion is a couple of things:
Is there a way to prevent redirects from being automatically handled? I can see value in being able to control the redirect myself from within the SPA.
If anyone have any insight into my CORS issue that would also be great. I am going to do some more testing, and I hope this is will turn out to be a misconfiguration issue - however the CORS policy its complaining about would be set by the "https://login.microsoftonline.com/" and I have not his this problem when testing previously when testing from an MVC "Pages" application, and just hope that this is nothing to do with the way redirects are being handled in the front end that could cause this, and possiblby could be something beyond my control.
Beta Was this translation helpful? Give feedback.
All reactions