core icon indicating copy to clipboard operation
core copied to clipboard

Route not working

Open SeanPatten opened this issue 1 year ago • 2 comments

This URl is not picked up by the below Flight::route, it returns 404 route not found:

http://localhost/api/intune/hey?error=access_denied&error_description=AADSTS65004%3a+User+declined+to+consent+to+access+the+app.%0d%0aTrace+ID%3a+747c0cc1-ccbd-4e53-8e2f-48812eb24100%0d%0aCorrelation+ID%3a+362e3cb3-20ef-400b-904e-9983bd989184%0d%0aTimestamp%3a+2022-09-08+09%3a58%3a12Z&error_uri=https%3a%2f%2flogin.microsoftonline.com%2ferror%3fcode%3d65004&admin_consent=True&state=x2EUE0fcSj#

This URL IS picked up by the below Flight::Route: http://localhost/api/intune/hey?error=access_denied&error_uri=https%3a%2f%2flogin.microsoftonline.com%2ferror%3fcode%3d65004&admin_consent=True&state=x2EUE0fcSj#

It looks like something in the query parameter error_description is causing flight not to pick up this route.

If you have any ideas I'd appreciate it :)

Flight::route('GET /api/intune/hey', function () { die("hey"); });

SeanPatten avatar Sep 08 '22 10:09 SeanPatten

@SeanPatten , try replacing the "%0a" with "%20". Worked for me.

paxperscientiam avatar Sep 12 '22 02:09 paxperscientiam

@SeanPatten , try replacing the "%0a" with "%20". Worked for me.

I'd love to, but unfortunately, it's a response from Microsoft Client Token workflow, so I have no control over the query parameters. I have a workaround, I am sending them directly to the Angular site, and posting the data to the endpoint.

SeanPatten avatar Sep 12 '22 08:09 SeanPatten

huh, I actually am able to replicate this. I'll see if I can come up with a fix. Wonder why it's happening.

n0nag0n avatar Jan 11 '24 22:01 n0nag0n

@SeanPatten I figured it out. The regex needed to be adjusted to account for multiple lines. Thank goodness for 100% unit test coverage to figure this out :smile:

https://github.com/flightphp/core/pull/510/commits/c7a143db0425b9b6a89e39f95a87ebfeff0f7e31

n0nag0n avatar Jan 11 '24 22:01 n0nag0n