This commit is contained in:
2019-09-24 17:38:46 +00:00
parent cb2606fed1
commit c6a20c7ffc

View File

@@ -7,49 +7,53 @@ using System.Threading.Tasks;
namespace qbridge.Controllers namespace qbridge.Controllers
{ {
[Route("api/[controller]")] [Route("[controller]")]
[ApiController] [ApiController]
[Produces("application/json")] [Produces("application/json")]
public class AuthController : ControllerBase public class OAuthRedirectController : ControllerBase
{ {
public AuthController()
/*
Development tokens for QBOI oAuth2 "AyaNova_QBOI_2"
https://developer.intuit.com/v2/ui#/app/appdetail/b7urd26wgx/b7urd26xgp/keys
ClientID
ABj70Wv5gDauFd9KgKFwuvpQjfzTwEgodEG8tnBbS8mSQhNrZJ
Client Secret
XUmJyvEcEuwQuyhARUAm0a8G3gzbEAeMiATCLyFZ
Sandbox:
https://c50.sandbox.qbo.intuit.com/app/homepage
sandbox company_us_1
sandbox-quickbooks.api.intuit.com
*/
public OAuthRedirectController()
{ {
} }
// GET: api/Todo/5 // Redirect endpoint
[HttpGet("{login}/{password}")] //Step 4 here: https://developer.intuit.com/app/developer/qbo/docs/develop/authentication-and-authorization/openid-connect
public async Task<ActionResult<QItem>> Get(string login, string password) [HttpGet]
public IActionResult Get([FromQuery]string state, [FromQuery]string code)
{ {
var QItem = new QItem(); return Content($"State: {state}, Code: {code}");
QItem.Token1 = "Test token 1";
QItem.Token2 = System.DateTime.Now.ToString();
QItem.Token3 = login;
if (QItem == null)
{
return NotFound();
}
return QItem;
} }
public class QItem
{
public string Token1 { get; set; }
public string Token2 { get; set; }
public string Token3 { get; set; }
}
/* /*
Plan: Plan:
Make a web APP and api that runs on our server and handles getting tokens from the QB Online oAuth2 endpoints Make a web APP and api that runs on our server and handles getting tokens from the QB Online oAuth2 endpoints
Docs for normal development are here: https://developer.intuit.com/app/developer/qbo/docs/develop/authentication-and-authorization
Tentative process: Tentative process:
Borrowing from the technique and concepts outlined here: http://relasoft.net/KB10004.html Borrowing from the technique and concepts outlined here: http://relasoft.net/KB10004.html