This commit is contained in:
2019-10-01 22:10:14 +00:00
parent df942c859b
commit a1a1c67657

View File

@@ -298,7 +298,7 @@ namespace AyaNova.PlugIn.QBOI
const string Q2_CLIENT_SECRET = "XUmJyvEcEuwQuyhARUAm0a8G3gzbEAeMiATCLyFZ"; const string Q2_CLIENT_SECRET = "XUmJyvEcEuwQuyhARUAm0a8G3gzbEAeMiATCLyFZ";
const string Q2_REDIRECT_URL = "https://qboauth.ayanova.com/redirect"; const string Q2_REDIRECT_URL = "https://qboauth.ayanova.com/redirect";
const string Q2_ENVIRONMENT = "Sandbox"; const string Q2_ENVIRONMENT = "Sandbox";
static string QBOI2_SESSION_TOKEN = "";
//simple xor encryption //simple xor encryption
@@ -339,6 +339,25 @@ namespace AyaNova.PlugIn.QBOI
// } // }
public static UInt64 RandomUint64()
{
using (System.Security.Cryptography.RNGCryptoServiceProvider rng = new System.Security.Cryptography.RNGCryptoServiceProvider())
{
var buffer = new byte[sizeof(UInt64)];
rng.GetBytes(buffer);
return BitConverter.ToUInt64(buffer, 0);
}
}
public static string RandomSessionToken()
{
using (System.Security.Cryptography.RNGCryptoServiceProvider rng = new System.Security.Cryptography.RNGCryptoServiceProvider())
{
var buffer = new byte[sizeof(UInt64)];
rng.GetBytes(buffer);
return Convert.ToBase64String(buffer);
}
}
static ServiceContext SC = null; static ServiceContext SC = null;
@@ -348,6 +367,16 @@ namespace AyaNova.PlugIn.QBOI
//then test that all ops work witha fresh company connection //then test that all ops work witha fresh company connection
static public void StartAuthorization() static public void StartAuthorization()
{ {
//used to tie this session to the auth key on our server for fetching later
QBOI2_SESSION_TOKEN = RandomSessionToken();
System.Diagnostics.Process.Start("https://qboauth.ayanova.com/start/" + QBOI2_SESSION_TOKEN);
//here we need to loop checking for the data we need on qboauth site or quit if user selects quit so
//a special dialog is required here or something
Intuit.Ipp.OAuth2PlatformClient.OAuth2Client oac = new OAuth2Client(Q2_CLIENT_ID, Q2_CLIENT_SECRET, Q2_REDIRECT_URL, Q2_ENVIRONMENT); Intuit.Ipp.OAuth2PlatformClient.OAuth2Client oac = new OAuth2Client(Q2_CLIENT_ID, Q2_CLIENT_SECRET, Q2_REDIRECT_URL, Q2_ENVIRONMENT);