skip to Main Content

I currently have an integration with another system that has its own SDK. The SDK authenticates using query string parameters which is working fine. However, we are updating the integration to use more of our application but due to redirects it loses the query string needed.

We have a session variable that is set on an incoming request that we can use to flag when the query string should be appended but need this to be done at the highest level to prevent the need in checking this in multiple places. I have tried middleware but it doesn’t seem to add the query string.

Anyone have any ideas?

Created middleware and registered it. tried the following code:

URL::defaults(['test'=>'test']);
$request->merge(['test'=>'test']);
$request->fullUrlWithQuery(['test' => 'test']);

What is required is that an incoming request and subsequent redirects change from http://example.com/submissions into http://example.com/submissions?test=test

2

Answers


  1. If want to append you sessions variables to the query, do it a simple way.

    $url = $request->fullUrl();
    if (str_contains($url, '?')) {
        $url .= '&test=test';
    } else {
        $url .= '?test=test';
    }
    return redirect($url);
    
    Login or Signup to reply.
  2. $request = Request::capture();
        $url = $request->url();
    
        if (strpos($url, '?') !== false) {
            $url .= '&test=test';
        } else {
            $url .= '?test=test';
        }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search