1. Go to this page and download the library: Download rs/auth-onekey 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/ */
//Http\Controllers\OneKeyLoginController.php
use RedSnapper\OneKey\OneKeyProvider;
//..//
public function handleProviderCallback(OneKeyProvider $provider)
{ // Get OneKey user from the provider
$providerUser = $provider->user();
//Map the one-key user with your User model, save in DB
// or perform any other action
$user = new User([
'id' => $providerUser->getId(),
'name' => $providerUser->getFullName(),
'email' => $providerUser->getEmail(),
'guard' => 'web'
]);
session()->put($user->guard, $user->toArray());
auth($user->guard)->login($user);
return redirect()->intended();
}