PHP code example of antwerpes / socialite-doccheck
1. Go to this page and download the library: Download antwerpes/socialite-doccheck 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/ */
antwerpes / socialite-doccheck example snippets
'doccheck' => [
'client_id' => env('DOCCHECK_CLIENT_KEY'),
'client_secret' => env('DOCCHECK_CLIENT_SECRET'),
'redirect' => env('DOCCHECK_REDIRECT_URI'),
'language' => env('DOCCHECK_LANGUAGE', 'de'),
'template' => env('DOCCHECK_TEMPLATE', 'fullscreen_dc'),
'license' => env('DOCCHECK_LICENSE', 'economy'),
],
use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
use Laravel\Socialite\Facades\Socialite;
class LoginController extends Controller
{
public function handleProviderCallback(Request $request)
{
$details = Socialite::driver('doccheck')->user();
$user = User::query()
->firstOrNew([
'id' => $details->getId(),
])
// Only available with the `business` license
->fill([
'email' => $details->getEmail(),
'first_name' => $details->first_name,
'last_name' => $details->last_name,
'title' => $details->title,
'street' => $details->street,
'postal_code' => $details->street,
'city' => $details->city,
'country' => $details->country,
'language' => $details->language,
'gender' => $details->gender,
'profession_id' => $details->profession_id,
'discipline_id' => $details->discipline_id,
]);
$user->save();
auth()->login($user);
return redirect()->intended('/');
}
}
public function showLoginForm(): Response
{
$url = Socialite::driver('doccheck')->redirect()->getTargetUrl();
return response()->view('auth.login', [
'url' => $url,
]);
}
<iframe
align="left"
frameborder="0"
width="467"
height="231"
name="dc_login_iframe"
id="dc_login_iframe"
src="{{ $url }}"
>
<a href="{{ $url }}" target="_blank">LOGIN</a>
</iframe>