1. Go to this page and download the library: Download socialiteproviders/imis library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
// -- When handling a POST to the callback url
public function oauthHandleCallback(Request $request, String $provider): RedirectResponse
{
switch ($provider) {
case "imis":
// Copy 'refresh_token' to a 'code' for use in Socialite
$request->request->add(['code' => $request->post('refresh_token')]);
// Fails if user is a guest
try {
$user = Socialite::driver('imis')->stateless()->user();
}
catch(\Throwable $e) {
// Redirect to Imis login
return redirect()->away(config('services.imis.host').'/'.config('services.imis.login_url'));
}
break;
default:
dd('provider fail not found');
}
$authUser = $this->findOrCreateUser($user, $provider);
Auth::login($authUser, true);
return redirect(config('app.url').'/member');
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.