'Customer', // 'invoice' => 'Invoice', // 'product' => 'Item', // 'payment' => 'Payment' // ]; public function onAuthorized(AuthorizedQuickbooksRequest $request) { MultiDB::findAndSetDbByCompanyKey($request->getTokenContent()['company_key']); $company = $request->getCompany(); $qb = new QuickbooksService($company); $realm = $request->query('realmId'); $access_token_object = $qb->sdk()->accessTokenFromCode($request->query('code'), $realm); $qb->sdk()->saveOAuthToken($access_token_object); return redirect(config('ninja.react_url')); } /** * Determine if the user is authorized to make this request. * */ public function authorizeQuickbooks(AuthQuickbooksRequest $request, string $token) { MultiDB::findAndSetDbByCompanyKey($request->getTokenContent()['company_key']); $company = $request->getCompany(); $qb = new QuickbooksService($company); $authorizationUrl = $qb->sdk()->getAuthorizationUrl(); $state = $qb->sdk()->getState(); Cache::put($state, $token, 190); return redirect()->to($authorizationUrl); } }