function attainAccessToken(iGrantTokenRequest $grant)
    {
        // client_id, secret_key can send as Authorization Header Or Post Request Body
        $grantParams = $grant->assertTokenParams();

        $response = $this->call( new Token($grantParams) );
        if ( $ex = $response->hasException() )
            throw $ex;

        /** @var DataEntity $r */
        $r = $response->expected();
        if (! $r->get('access_token') )
            // It not fulfilled with access_token; in case of two step validation like single-signin
            // return response otherwise access token
            return $r;


        return new AccessTokenObject($r);
    }
function attainAccessToken(iGrantTokenRequest $grant)
    {
        // client_id, secret_key can send as Authorization Header Or Post Request Body
        $grantParams = $grant->assertTokenParams();

        $response = $this->call( new Token($grantParams) );
        if ( $ex = $response->hasException() )
            throw $ex;

        /** @var DataEntity $r */
        $r = $response->expected();
        if (! $r->get('access_token') )
            // It not fulfilled with access_token; in case of two step validation like single-signin
            // return response otherwise access token
            return $r;


        return new AccessTokenObject($r);
    }
function attainAccessToken ( iGrantTokenRequest $ grant ) { // client_id, secret_key can send as Authorization Header Or Post Request Body $ grantParams = $ grant -> assertTokenParams ( ) ; $ response = $ this -> call ( new Token ( $ grantParams ) ) ; if ( $ ex = $ response -> hasException ( ) ) throw $ ex ; /** @var DataEntity $r */ $ r = $ response -> expected ( ) ; if ( ! $ r -> get ( 'access_token' ) ) // It not fulfilled with access_token; in case of two step validation like single-signin // return response otherwise access token return $ r ; return new AccessTokenObject ( $ r ) ; }
Requests an access token using a specified grant.

@param iGrantTokenRequest $grant

@return iAccessTokenObject|DataEntity
@throws \Exception
Requests an access token using a specified grant .