src/sb/Controller/Google/Auth.php
public function login(){
        if ($this->getGet('code')) {
            $this->client->authenticate($this->getGet('code'));
            $this->setSession('token', $this->client->getAccessToken());

            $redirect = $this->config->redirect_uris[0];
            header('Location: ' . filter_var($redirect, FILTER_SANITIZE_URL));
            return;
        }


        $token = $this->getSession('token');
        if ($token) {
            $this->client->setAccessToken($token);
        }

        if ($this->client->getAccessToken()) {
            $user = $this->oauth2_service->userinfo->get();
            $this->setSession('token', $this->client->getAccessToken());
            return $user;
        }
    }
public function login(){
        if ($this->getGet('code')) {
            $this->client->authenticate($this->getGet('code'));
            $this->setSession('token', $this->client->getAccessToken());

            $redirect = $this->config->redirect_uris[0];
            header('Location: ' . filter_var($redirect, FILTER_SANITIZE_URL));
            return;
        }


        $token = $this->getSession('token');
        if ($token) {
            $this->client->setAccessToken($token);
        }

        if ($this->client->getAccessToken()) {
            $user = $this->oauth2_service->userinfo->get();
            $this->setSession('token', $this->client->getAccessToken());
            return $user;
        }
    }
public function login ( ) { if ( $ this -> getGet ( 'code' ) ) { $ this -> client -> authenticate ( $ this -> getGet ( 'code' ) ) ; $ this -> setSession ( 'token' , $ this -> client -> getAccessToken ( ) ) ; $ redirect = $ this -> config -> redirect_uris [ 0 ] ; header ( 'Location: ' . filter_var ( $ redirect , FILTER_SANITIZE_URL ) ) ; return ; } $ token = $ this -> getSession ( 'token' ) ; if ( $ token ) { $ this -> client -> setAccessToken ( $ token ) ; } if ( $ this -> client -> getAccessToken ( ) ) { $ user = $ this -> oauth2_service -> userinfo -> get ( ) ; $ this -> setSession ( 'token' , $ this -> client -> getAccessToken ( ) ) ; return $ user ; } }
Logs in the user
@return \stdClass
@servable true
Logs in the user