This commit is contained in:
2019-09-26 18:21:25 +00:00
parent e507e76c62
commit 9f5b0ebef4

View File

@@ -61,19 +61,7 @@ namespace qbridge.Controllers
}
//bugbug: It's not prompting for the company I want like the playground does...what's up with that? Is it because I need to follow the OpenID method rather than the "web app" method??
//realmid is companyid in some examples but I don't get prompted for it unless I use the playground version
//maybe the example I followed assumes you already have the company ID when you make subsequent api calls
/*
Stuff from playground
Step 1 if I select only openID scope (no company prompt)
https://appcenter.intuit.com/connect/oauth2?client_id=ABj70Wv5gDauFd9KgKFwuvpQjfzTwEgodEG8tnBbS8mSQhNrZJ&scope=openid%20profile%20email%20phone%20address&redirect_uri=https://developer.intuit.com/v2/OAuth2Playground/RedirectUrl&response_type=code&state=PlaygroundAuth
Step 1 if I select accounting only and not openid scope:
https://appcenter.intuit.com/connect/oauth2?client_id=ABj70Wv5gDauFd9KgKFwuvpQjfzTwEgodEG8tnBbS8mSQhNrZJ&scope=com.intuit.quickbooks.accounting&redirect_uri=https://developer.intuit.com/v2/OAuth2Playground/RedirectUrl&response_type=code&state=PlaygroundAuth
*/
[HttpGet("Start/{qboid}")]
public async Task<IActionResult> GetAsync([FromRoute]string qboid)
@@ -128,8 +116,11 @@ https://appcenter.intuit.com/connect/oauth2?client_id=ABj70Wv5gDauFd9KgKFwuvpQjf
// Redirect endpoint
//Step 4 here: https://developer.intuit.com/app/developer/qbo/docs/develop/authentication-and-authorization/openid-connect
[HttpGet]
public async Task<IActionResult> GetAsync([FromQuery]string state, [FromQuery]string code)
public async Task<IActionResult> GetAsync([FromQuery]string state, [FromQuery]string code, [FromQuery]string realmId)
{
//NOTE: state is our own state provided in the initial auth redirect
//code is authorization code used to then get the refresh and access token
//realmId is the id of the actual company database to work with chosen by user on login
//We arrive here after the user has logged in and now we should have the authorization code that can now be used to fetch the actual tokens we need
var TokenEndpoint = DiscoveryDoc["token_endpoint"].Value<string>();
@@ -177,13 +168,13 @@ https://appcenter.intuit.com/connect/oauth2?client_id=ABj70Wv5gDauFd9KgKFwuvpQjf
/*
Actual response example:
TOKEN: {
"access_token": "eyJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwiYWxnIjoiZGlyIn0..jUV9qU1fnLn8U1KWBj7VuQ.0734yzJslW7Mp9pOIh6NTQZO-hEFJp_5R2JIJecQkJ866rWg9U3FVilwTaBmMEtC3AR4AxJva1nf_LU4JJNA2_EWtRxItHXbVsa54yk5-uELr-42IKjIXlWm1vWQQnkJRye8gZvy6LJAVmbL8exX3WIDHZjauObvLYEifgWAx2HhYrkWfTwY0T4trxxMOmjRMHARXsi-4VPTuMZNgSLEf0ipu7UVepb6lM4T0rXtUHTFwp1W4-dbwbihD7OX6eBS68LX4FIGno6kxMB89sGOf8JUEx6wKyTg7GBll64aOEAf6_hqkh7dIjyLmDXtfyQvB8K77QHTGpPVQOVw8O66_QSx4ePiI6WFhQtUTIdKSlO8w3pmcVcq-iEnAP2GJlwgg1zMBb83QX1LRICjsGMYZwSMNBPlNcuasBcKHJSa3TftTqcm1DB35Cn1CY7Ulte8y4ClkjXQztdL4fJRFUpMCSZ-QSYfgGCfhATM7YE1ErFaXhgpCwsYxACU6G7mDSC9AcTuCupAVSDOas9tuuqsndETahXrhrp83NZMukXgnhv9eC_ac3N6jcog-hjvzsvkNfjSEqyiMWaC3yNQx5Qp0LDCsd2Byx3Feg8QUqhmI8XK6on1fxyJeZxv4o3kyciSVF6KzgJMgB6mYjv-tQ2tpjvCxb2AkSoI2tRkUic9UoRUsWZBNOLmZr8nw6xZ_e1IYkU9gWkh0hmiWB648onghQPWIJOl5hak1a5HSaoEQbkL_ouZwIMWgM2M02GeFrEr.m1xIClqQIgBZyDDcjfPvAg",
"x_refresh_token_expires_in": 15552000,
"refresh_token": "AB11584991271bMYG1tOJ3YyUw7CeaeI2ctbrwD2kZQ6AXnAbd",
"token_type": "bearer",
"expires_in": 3600,
"id_token": "eyJraWQiOiJPUElDUFJEMDkxODIwMTQiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiIxNDQ5O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