Retrieve users/company information

耗尽温柔 提交于 2019-12-12 04:36:15

问题


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

来源:https://stackoverflow.com/questions/40213837/retrieve-users-company-information

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!