src/AuthorizesWithOAuth2.php
protected function getAccessToken()
    {
        switch ($this->grant) {
            case 'provided_token':
                return $this->token;

            case 'client_credentials':
                return $this->getFrameworkBridge()->getClientToken();

            case 'authorization_code':
                $user = $this->getFrameworkBridge()->getCurrentUser();

                if (! $user) {
                    return null;
                }

                return $user->getOAuthToken();

            default:
                throw new \Exception('Unsupported grant type. Check $this->grant.');
        }
    }
protected function getAccessToken()
    {
        switch ($this->grant) {
            case 'provided_token':
                return $this->token;

            case 'client_credentials':
                return $this->getFrameworkBridge()->getClientToken();

            case 'authorization_code':
                $user = $this->getFrameworkBridge()->getCurrentUser();

                if (! $user) {
                    return null;
                }

                return $user->getOAuthToken();

            default:
                throw new \Exception('Unsupported grant type. Check $this->grant.');
        }
    }
protected function getAccessToken ( ) { switch ( $ this -> grant ) { case 'provided_token' : return $ this -> token ; case 'client_credentials' : return $ this -> getFrameworkBridge ( ) -> getClientToken ( ) ; case 'authorization_code' : $ user = $ this -> getFrameworkBridge ( ) -> getCurrentUser ( ) ; if ( ! $ user ) { return null ; } return $ user -> getOAuthToken ( ) ; default : throw new \ Exception ( 'Unsupported grant type. Check $this->grant.' ) ; } }
Get the access token from the repository based on the chosen grant.

@return AccessToken|null
@throws \Exception
Get the access token from the repository based on the chosen grant .