| 12345678910111213141516171819202122232425262728293031323334353637383940414243 | <?phpnamespace App\libs\google\Gateways;use Google\Client;use Illuminate\Support\Facades\Config;class GoogleOauth{    private  $config;    private  $client;    public function __construct()    {        $this->config = Config::get('swdz.goodle');        $this->client = new Client([            'client_id' => $this->config['client_id'],            'client_secret' => $this->config['client_secret'],            'redirect_uri' => $this->config['redirect_uri'],            'scopes' => $this->config['scopes']        ]);    }    /**     * APP通过code换取用户信息     *     * @return array|false     * @throws \Psr\Container\ContainerExceptionInterface     * @throws \Psr\Container\NotFoundExceptionInterface     */    public  function appAuth(){        $code = request()->get('code', null);        return $this->client->verifyIdToken($code);    }    /**     * WEB打开授权页面(待补充)     *     * @return void     */    public static function webAuth(){    }}
 |