Skip to content

Commit

Permalink
Show the error message if the OAuth failed
Browse files Browse the repository at this point in the history
If the Connect to QuickBooks flow failed, this shows the error message received on the page so that the user can be alerted to fix the problem. Before this change, the callback page ignored the error and attempted to get a token anyway, resulting in a confusing PHP error message (see IntuitDeveloper#2).
  • Loading branch information
ADTC authored Dec 5, 2018
1 parent 0fdef8c commit 24d1d12
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion callback.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ function processCode()
$OAuth2LoginHelper = $dataService->getOAuth2LoginHelper();
$parseUrl = parseAuthRedirectUrl($_SERVER['QUERY_STRING']);

if(isset($parseUrl['error'])) {
echo 'Error: ' . $parseUrl['error'];
return;
}

/*
* Update the OAuth2Token
*/
Expand All @@ -38,11 +43,12 @@ function parseAuthRedirectUrl($url)
{
parse_str($url,$qsArray);
return array(
'error' => $qsArray['error'],
'code' => $qsArray['code'],
'realmId' => $qsArray['realmId']
);
}

$result = processCode();

?>
?>

0 comments on commit 24d1d12

Please sign in to comment.