system/library/social/google.php

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php
/**
 * google.php
 *
 * @copyright  2019 damicms.com - All Rights Reserved
 * @link       http://www.guangdawangluo.com
 * @author     Edward Yang <yangjin@damicms.com>
 * @created    2019-05-07 10:17
 * @modified   2019-05-07 10:17
 */


namespace Social;


class Google extends Base
{
    const PROVIDER = 'google';

    private $clientId;
    private $clientSecret;
    private $redirect;
    private $request;
    private $driver;

    /**
     * Google constructor.
     * @param array $socialData
     * @throws \Exception
     */
    public function __construct($socialData = [])
    {
        parent::__construct(self::PROVIDER);
        if (empty($socialData)) {
            $socialData = $this->getSocialByProvider(self::PROVIDER);
        }
        $this->clientId = array_get($socialData, 'client_id');
        $this->clientSecret = array_get($socialData, 'client_secret');
        $this->redirect = array_get($socialData, 'redirect');
        $this->request = request();
        $this->driver = $this->getSocialiteDriver(self::PROVIDER);
    }

    /**
     * @return string
     */
    public function redirectAuthUrl()
    {
        //$this->driver->scopes(['https://www.googleapis.com/auth/userinfo.email']);
        $redirectUrl = $this->driver->redirect()->getTargetUrl();
        $this->logInfo("Redirect URL: {$redirectUrl}");
        return $redirectUrl;
    }

    /**
     * @return array
     */
    public function getUserData()
    {
        $user = $this->driver->stateless()->user();
后面还有 15 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。