From 9c5a0f2ae127e22990c682acdea3ef9d76730b67 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Tue, 1 Oct 2019 18:28:47 +0000 Subject: [PATCH] --- .vscode/launch.json | 4 ++-- Controllers/AuthController.cs | 21 ++++++++++++++++++--- Program.cs | 6 +++++- 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index e35c856..1285f10 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -35,8 +35,8 @@ "action": "openExternally", //"pattern": "^\\s*Now listening on:\\s+(https?://\\S+)", //https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md#specifying-the-browsers-url - "pattern": "^\\s*Now listening on:\\s+http://\\S+:([0-9]+)", - "uriFormat": "http://localhost:%s/start/" + "pattern": "^\\s*Now listening on:\\s+https://\\S+:([0-9]+)", + "uriFormat": "https://localhost:%s/start/222" }, "env": { "ASPNETCORE_ENVIRONMENT": "Development" diff --git a/Controllers/AuthController.cs b/Controllers/AuthController.cs index 0e1ef96..889e5be 100644 --- a/Controllers/AuthController.cs +++ b/Controllers/AuthController.cs @@ -20,7 +20,7 @@ namespace qbridge.Controllers public const string CLIENT_SECRET = "XUmJyvEcEuwQuyhARUAm0a8G3gzbEAeMiATCLyFZ"; #if (DEBUG) - public const string REDIRECT_URI = "https://localhost:5001/redirect"; + public const string REDIRECT_URI = "https://localhost:3003/redirect"; #else public const string REDIRECT_URI = "https://qboauth.ayanova.com/redirect"; #endif @@ -70,7 +70,7 @@ namespace qbridge.Controllers { _clientFactory = clientFactory; } - + @@ -181,7 +181,22 @@ namespace qbridge.Controllers AccessTokenObject = null; } - return Content($"TOKEN: {AccessTokenObject.ToString()}"); + + var refresh_token = AccessTokenObject["refresh_token"].Value(); + var access_token = AccessTokenObject["access_token"].Value(); + var x_refresh_token_expires_in = AccessTokenObject["x_refresh_token_expires_in"].Value(); + var access_token_expires_in = AccessTokenObject["expires_in"].Value(); + + return Ok(new + { + access_token = access_token, + access_token_expires_in = access_token_expires_in, + refresh_token = refresh_token, + x_refresh_token_expires_in = x_refresh_token_expires_in, + realmId = realmId, + code = code + }); + //return Content($"ACCESS TOKEN: {access_token}, REFRESH TOKEN: {refresh_token}, REALM:{realmId}, STATE:{state}, CODE:{code}"); /* Actual response example: diff --git a/Program.cs b/Program.cs index 76a8341..9a8c1ca 100644 --- a/Program.cs +++ b/Program.cs @@ -12,7 +12,11 @@ namespace qbridge public static IWebHostBuilder CreateWebHostBuilder(string[] args) => WebHost.CreateDefaultBuilder(args) +#if (DEBUG) + .UseUrls("https://*:3003") +#else .UseUrls("http://*:3003") - .UseStartup(); +#endif + .UseStartup(); } }