Forum

How do I make laravel toolkit work with socialite string query

Edison (zentinela@gmail.com)
28 May 2016, 23:56
I've installed and configured Hiawatha and Laravel using this UrlToolkit:
UrlToolkit {
ToolkitID = laravel
RequestURI exists Return
Match .* Rewrite /index.php
}

Laravel works fine, but then I installed and configured socialite for laravel, which is a social network login add-on. Laravel needs to read the answer given by the social network through socialite by recognizing a URL formed in this way https://server.domain/callback?code=AAABAAAA...&state=OO8...&session_state=841b...

I've tried modifing the UrlToolKit in order to support string query in laravel, but it didn't worked.
UrlToolkit {
ToolkitID = laravel
RequestURI exists Return
Match /(.*) Rewrite /index.php/$1
}
Edison
29 May 2016, 04:22
Nginx solves this issue doing a location rewrite, how can I do something similar in hiawatha:
location /laravel {
try_files $uri $uri/ /index.php?$query_string;
}
Edison
29 May 2016, 05:52
Ok, after some reading and configuration tries I finally got a solution with a new UrlToolKit and a laravel php workaround.
UrlToolkit {
ToolkitID = laravel
RequestURI exists Return
Match /(.*) Rewrite /index.php?$1
}

public function callback(Request $request) {
$code = $request->get('callback?code');
$input = array_map('trim', $request->all());
$input['code'] = $code;
$state = $request->replace($input);
dd($request);
}
Hugo Leisink
29 May 2016, 06:40
If you want '/index.php/$1' to work, you need to set 'EnablePathInfo = yes' in the virtual host configuration.
Edison
30 May 2016, 16:24
Ok, 'EnablePathInfo = yes' and 'EnablePathInfo = yes' made the trick. Laravel workaround is not necessary with this changes. Thank you Hugo
This topic has been closed.