Retrieve users/company information

2019-09-03 15:58发布

问题:

On connecting to Quickbook within our app we are able to get access token and realmid but on trying to implement Get App Now we couldn't get any information after redirecting to our openid url. What I have tried so far is

define('OAUTH_CONSUMER_KEY', $consumerkey);
        define('OAUTH_CONSUMER_SECRET', $consumersecret);

        define('OAUTH_URL', 'https://oauth.intuit.com/');
        define('APPCENTER_URL', 'https://appcenter.intuit.com/');

        define('OAUTH_REQUEST_URL', OAUTH_URL . 'oauth/v1/get_request_token');
        define('OAUTH_ACCESS_URL', OAUTH_URL . 'oauth/v1/get_access_token');
        define('OAUTH_AUTHORISE_URL', APPCENTER_URL . 'Connect/Begin');
        define('OAUTH_CURRENT_USER', APPCENTER_URL . 'api/v1/user/current');
try{

    $oauth = new OAuth(OAUTH_CONSUMER_KEY,OAUTH_CONSUMER_SECRET,OAUTH_SIG_METHOD_HMACSHA1,OAUTH_AUTH_TYPE_URI);
    $oauth->enableDebug();

    $request_token = $oauth->getRequestToken(OAUTH_CURRENT_USER,CALLBACK_URL);
    echo '<pre>';
    print_r($_POST);
    print_r($_GET);
    print_r($_REQUEST);
    print_r($_SESSION);
    echo $request_token;
    print_r($request_token);
    echo '</pre>';

} catch(OAuthException $e) {
    pr($e);
}

I can't get any valuable information on the above code, I maybe doing it wrong and expecting that there would be realmid and access token once the authorization is done and quickbooks redirect to our openid url. Any information would be appreciated.

Please note I really don't have knowledge about this as this is my first time using quickbooks api and related technologies.

Updated

<?php
    require 'openid.php';
try {
    # Change 'localhost' to your domain name.
    $openid = new LightOpenID($_SERVER["HTTP_HOST"]);


    if(!$openid->mode) {
        if(isset($_GET['login'])) {

            $openid->identity = 'https://openid.intuit.com/OpenId/Provider';//'https://www.google.com/accounts/o8/id';
            $openid->required = array(
                'contact/email',
                'namePerson/first',
                'namePerson/last'
            );

            header('Location: ' . $openid->authUrl());
        }
        ?>
        <form action="?login" method="post">
            <button>Login with Google</button>
        </form>
        <?php
    } elseif($openid->mode == 'cancel') {
        echo 'User has canceled authentication!';
    } else {
        echo 'User ' . ($openid->validate() ? $openid->identity . ' has ' : 'has not ') . 'logged in.';
    }
} catch(ErrorException $e) {
    echo $e->getMessage();
}

When the form above gets submitted it results into No OpenID Server found at https://openid.intuit.com/OpenId/Provider