This commit is contained in:
@@ -29,6 +29,8 @@ using System.Linq;
|
||||
//oauth2
|
||||
using Intuit.Ipp.OAuth2PlatformClient;
|
||||
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
//QUICKBOOKS ONLINE INTERFACE
|
||||
//MAIN CASE WITH NOTES:
|
||||
//https://fog.ayanova.com/default.asp?3217
|
||||
@@ -388,15 +390,30 @@ namespace AyaNova.PlugIn.QBOI
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(gt.FetchedToken))
|
||||
{
|
||||
|
||||
IntegrationLog.Log(QBID, "PFC: QuickBooks online retrieved token is empty! Unable to proceed.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//parse the token and store the values in the session variables
|
||||
JObject j=JObject.Parse(gt.FetchedToken);
|
||||
/* example return value
|
||||
{
|
||||
"realmId": "193514527954149",
|
||||
"access_token": "eyJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwiYWxnIjoiZGlyIn0..f_bBkYjAwaN2H9cVLHDDog.XNz0F7PN96vJhpdn6y-yVv85sqBGI0QQYucLQ4NjzKfk3eKmTh0es8hJofZufequZu1dqy1q8wIuJ3kGABsKqL6yUy3kDg9jrED-bgqMaDHAbafLdaMuzVmzwF2pnR1M61ey5rxfio2Nr54q9_HhRJpealHyiM4hDXhA87FVbMP1pqH43HB5dt6WIu4EFnNX-HSWEZCa-LeYTn39bGpCdxA89WQyi4B_fnVvF1YhbzWe3GINZV3bHrVlD9flslBuym_HHNISapSK9AKwx71upAgRhxGf9Q5aBvb3w5-HCQYTbZZv2oooTApFP6SnrxhEC7d11h2e2_cDlCvvxeGaK5ZqmeOzwZKY72Fmum50UB61ChoLEFl_odW2e8GZY_f7EavufVklj9yWu-zuFeExSwHEP-QCbFZ10EvP5BIxB0os2vRXfS906zVpFJACuAaoVrfpIlRa0QIPMpwLuN50lONPMV1xBRGuodqs7R550Pm-5Bff6-Im-ialg9sLkETSsE9ICsJ7z4p2wQ1Z9b_Cdz6fbOUSotv8uwK2ke4mKTRKejbl6UfDG8DNoeCGMcaF7VDLd_8X8UdMU2gYH6Y9EEOFbX6MOpmUUIsyd-0WLZjDTya6bbLONsrpZmZXXX12n5pDykXxachl6I6XR0vuhGnF6Z_CSvOjYWrArQ8IY8SF9oobgFWi0wy_izurVq5R.ltpcEsh0zXmOBmRTggommQ",
|
||||
"refresh_token": "AB11578778808Neoah1qLV0tgnNrnr4T9mJkIlTY5nZdOieQdo",
|
||||
"tokenBirthday": "2019-10-02T14:40:08.4855781-07:00"
|
||||
}
|
||||
* */
|
||||
|
||||
|
||||
//LOOP over and over every 5 seconds checking repeatedly for the state token to get off the server or until user selects quit in some dialog that needs to be shown here
|
||||
|
||||
|
||||
//If user selects cancel then just exit qboi
|
||||
|
||||
//When token found at server under this session token id then fetch it and continue on from here
|
||||
string ACCESS_TOKEN = j["access_token"].Value<string>();
|
||||
string REFRESH_TOKEN = j["refresh_token"].Value<string>();
|
||||
string REALM_ID = j["realmId"].Value<string>();
|
||||
|
||||
//NOTE: this app will handle refreshing the token in-session as apparently that's possible from here, maybe should test that or could simply just refresh via our server
|
||||
|
||||
@@ -406,9 +423,7 @@ namespace AyaNova.PlugIn.QBOI
|
||||
//https://help.developer.intuit.com/s/question/0D50f00005gFeqpCAC/how-do-i-suddenly-get-there-was-an-error-while-communicating-with-the-ids-server
|
||||
System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12; //Add this just to be sure to use TLS1.2
|
||||
|
||||
string ACCESS_TOKEN = "eyJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwiYWxnIjoiZGlyIn0..fkamwb-fxretczISZ8SnZA.YlEEozgjX_3DpXP-v3DoEaPKsJ8ql7U6EIxGOWVJvBwCLpflke9EyV_A-f8mJ5NeSCzZEwHPGcwJ0FteOUUycN1SmYX2HTXMsW00-SFeYOaJLc683bgwFMjLaTtYzzUCzWNNEzGXh_pgwMzZguLZAK9VwUDD3NBPE4fuXysglUIECkCmGkUYuP0AyJGDerwoPJRFQBFqbQwB6gd7cx7vO5Ge8zoNlcAe-ylWEaVCc0h5wnmY5GfpJrNBNgu-B9Wh9Ja1T6JWTTmZ0IkbmIG8og5XGnWetcX3iZHLm9JLxz1RKnFXTECGZbmKTqEhkc3PkFb7Ctktt_q61T_GKzDzKTmdYuwOrXTgQtpeQ5c64dvxGmhpXS3E7TbB_BEzAbuLLyGI8Uqr2g_kOqrTXWOzLhzl-FGwdYur8BzG7sdaaLEQEPMotROdvkN74OvKBKP0kfJvRMxPAnL3YMt0FPv5tb5IajSlFu5m2smAZVTpPwnqojQ-bArz0VGcWRUPkR4hg5beMIAwBgwtAZolBtmIQybv8sPaG_XEkRLl8XiRZpAZ9n8p7JjQ4eFpXHBN3hiVyCGmDcY3autWyuyqIcHcGPkT7qsogAHixOkojXUEsf3JFrvQWADyVxqkHvnS1kWITB4rPO7k-i0lY2T4ZcRpOf-H_0r4O78HOOci740K1tnjJB0wJfKQPdTafOuyZykV.EQaz0CXGPby6LfeEmeXPZg";
|
||||
string REFRESH_TOKEN = "AB11578690079km40A6d51ghEBgErWvCbGuTgXZlNqQLKKLgNT";
|
||||
string REALM_ID = "193514527954149";
|
||||
|
||||
|
||||
Intuit.Ipp.Security.OAuth2RequestValidator validator = new Intuit.Ipp.Security.OAuth2RequestValidator(ACCESS_TOKEN);
|
||||
SC = new Intuit.Ipp.Core.ServiceContext(REALM_ID, Intuit.Ipp.Core.IntuitServicesType.QBO, validator);
|
||||
|
||||
Reference in New Issue
Block a user