How to connect to PHP QucckBooks using consolibyte API

风格不统一 提交于 2020-03-23 09:48:28

问题


I am trying to integrate my QuickBooks accounting system to my PHP based web application.

The integration was working all good until I decided to use OAuth 2 tokens in order to connect PHP with Quickbooks online.

I was looking resources [here][1] and looked at the following steps.

  1. Make a backup of your code
  2. Make a backup of your existing OAuth v1.0 tokens
  3. git clone the repository to get the new code
  4. Make code changes as detailed below
  5. Go get your Client ID and Client Secret from developer.intuit.com for your app

So, I did the backups and cloned the repository to get the new code.

I extracted the new repository and uploaded the code on my server.

I logged on to the developer.intuit.com and obtained my ‘Productions tokens’. So I have the ‘Client ID’ and ‘Client Secret’.

The next thing I did is opened config_oauthv2.php file and I have copied and pasted the Client ID and Client Secret.

$oauth_client_id = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
$oauth_client_secret = xxxxxxxxxxxxxxxxxxxxxxxxxxxxx;

Sandbox is set to false as I am using the productions tokens.

$sandbox = false;    // When you're using production tokens

I then changed the URL of Oauth handler, forward and menu to correct pages.

// This is the URL of your OAuth auth handler page
$quickbooks_oauth_url = 'https://xxxxxxxxxx/quickbooks-php-master/docs/partner_platform/example_app_ipp_v3/oauth.php';

// This is the URL to forward the user to after they have connected to IPP/IDS via OAuth
$quickbooks_success_url = 'https://xxxxxxxxxx/quickbooks-php-master/docs/partner_platform/example_app_ipp_v3/success.php';

// This is the menu URL script
$quickbooks_menu_url = 'https://xxxxxxxxxx/quickbooks-php-master/docs/partner_platform/example_app_ipp_v3/menu.php';

I then updated the $dsn with connection to the database.

$dsn = 'mysqli://xxxxxxxxxx@xxxxxxx/xxxxxxx';

I did not make any further changes so the rest of the code is the same as the repository.

// You should set this to an encryption key specific to your app
$encryption_key = 'bcde1234';

// Scope required
$scope = 'com.intuit.quickbooks.accounting ';

// The tenant that user is accessing within your own app
$the_tenant = 12345;

When I went to the Index.php URL. It displayed the following page.

[![index page][2]][2]

So I clicked “Connect to QuickBooks”, (I was hoping it will ask me to log into QuickBooks), but it displayed flowing page.

[![Error Image][3]][3]

Please, can you help me investigate the issue of why I cannot connect to Quickbooks?

Looks like when It goes to the oauth.php, it failed and returns

could not build an authorisation. Oh, No something bad happened`.

My oauth.php page code is the same as what I cloned from the repository.

EDIT response

Trying to hit URL: https://developer.api.intuit.com/.well-known/openid_sandbox_configuration

   Did we disable SSL checks? false
<br />
<b>Warning</b>:  curl_setopt(): cannot represent a stream of type Output as a STDIO FILE* in <b>C:\Program Files\FileMaker\FileMaker Server\HTTPServer\conf\qbapi\quickbooks-php-master\docs\partner_platform\example_app_ipp_v3\troubleshooting.php</b> on line <b>30</b><br />









Trying to hit URL: https://developer.api.intuit.com/.well-known/openid_configuration

   Did we disable SSL checks? false
<br />
<b>Warning</b>:  curl_setopt(): cannot represent a stream of type Output as a STDIO FILE* in <b>C:\Program Files\FileMaker\FileMaker Server\HTTPServer\conf\qbapi\quickbooks-php-master\docs\partner_platform\example_app_ipp_v3\troubleshooting.php</b> on line <b>30</b><br />









Trying to hit URL: https://developer.api.intuit.com/.well-known/openid_sandbox_configuration

   Did we disable SSL checks? true
<br />
<b>Warning</b>:  curl_setopt(): cannot represent a stream of type Output as a STDIO FILE* in <b>C:\Program Files\FileMaker\FileMaker Server\HTTPServer\conf\qbapi\quickbooks-php-master\docs\partner_platform\example_app_ipp_v3\troubleshooting.php</b> on line <b>30</b><br />



{  
   "issuer":"https://oauth.platform.intuit.com/op/v1",
   "authorization_endpoint":"https://appcenter.intuit.com/connect/oauth2",
   "token_endpoint":"https://oauth.platform.intuit.com/oauth2/v1/tokens/bearer",
   "userinfo_endpoint":"https://sandbox-accounts.platform.intuit.com/v1/openid_connect/userinfo",
   "revocation_endpoint":"https://developer.api.intuit.com/v2/oauth2/tokens/revoke",
   "jwks_uri":"https://oauth.platform.intuit.com/op/v1/jwks",
   "response_types_supported":[  
      "code"
   ],
   "subject_types_supported":[  
      "public"
   ],
   "id_token_signing_alg_values_supported":[  
      "RS256"
   ],
   "scopes_supported":[  
      "openid",
      "email",
      "profile",
      "address",
      "phone"
   ],
   "token_endpoint_auth_methods_supported":[  
      "client_secret_post",
      "client_secret_basic"
   ],
   "claims_supported":[  
      "aud",
      "exp",
      "iat",
      "iss",
      "realmid",
      "sub"
   ]
}







Trying to hit URL: https://developer.api.intuit.com/.well-known/openid_configuration

   Did we disable SSL checks? true
<br />
<b>Warning</b>:  curl_setopt(): cannot represent a stream of type Output as a STDIO FILE* in <b>C:\Program Files\FileMaker\FileMaker Server\HTTPServer\conf\qbapi\quickbooks-php-master\docs\partner_platform\example_app_ipp_v3\troubleshooting.php</b> on line <b>30</b><br />



{  
   "issuer":"https://oauth.platform.intuit.com/op/v1",
   "authorization_endpoint":"https://appcenter.intuit.com/connect/oauth2",
   "token_endpoint":"https://oauth.platform.intuit.com/oauth2/v1/tokens/bearer",
   "userinfo_endpoint":"https://accounts.platform.intuit.com/v1/openid_connect/userinfo",
   "revocation_endpoint":"https://developer.api.intuit.com/v2/oauth2/tokens/revoke",
   "jwks_uri":"https://oauth.platform.intuit.com/op/v1/jwks",
   "response_types_supported":[  
      "code"
   ],
   "subject_types_supported":[  
      "public"
   ],
   "id_token_signing_alg_values_supported":[  
      "RS256"
   ],
   "scopes_supported":[  
      "openid",
      "email",
      "profile",
      "address",
      "phone"
   ],
   "token_endpoint_auth_methods_supported":[  
      "client_secret_post",
      "client_secret_basic"
   ],
   "claims_supported":[  
      "aud",
      "exp",
      "iat",
      "iss",
      "realmid",
      "sub"
   ]
}







php version: 7.0.30
mcrypt extension? true
  mcrypt module rijndael-256? NULL
curl extension? true

来源:https://stackoverflow.com/questions/59934452/how-to-connect-to-php-qucckbooks-using-consolibyte-api

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