1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 23:22:52 +01:00
invoiceninja/app/Ninja/OAuth/OAuth.php
2017-08-08 12:55:50 +10:00

44 lines
791 B
PHP

<?php namespace App\Ninja\OAuth;
use App\Models\User;
class OAuth {
private $providerInstance;
public function __construct()
{
}
public function getProvider($provider)
{
switch ($provider)
{
case 'google';
$this->providerInstance = new Providers\Google();
return $this;
default:
return null;
break;
}
}
public function getTokenResponse($token)
{
$email = null;
$user = null;
if($this->providerInstance)
$user = User::where('oauth_user_id', $this->providerInstance->getTokenResponse($token))->first();
if ($user)
return $user;
else
return false;
}
}
?>