OAuth2_PHP
OAuth2_PHP copied to clipboard
Keep getting error when using a sand-box clientkey and secret key
Good Day...
I was trying to test OAuth with this sample but I keep getting error when redirected to https://appcenter.intuit.com/connect/oauth2?client_id=L0wfLei7A5qHX3OU62CU0DWMZyifQr6DINORlF4HdoyxQ36F8z&scope=com.intuit.quickbooks.accounting&redirect_uri=https%3A%2F%2Fqb.dagnum.com%2Ftest%2FOAuth2PHPExample.php&response_type=code&state=RandomState .. I couldn't even reach to the page wher it asks you to authorize the app.. however I could reach the authorize your app page If I do use the sample ClientKey and ClientKeySecret but still get an error after clicking authorize..
heres my config.php
<?php
return array(
'authorizationRequestUrl' => 'https://appcenter.intuit.com/connect/oauth2', //Example https://appcenter.intuit.com/connect/oauth2',
'tokenEndPointUrl' => 'hhttps://oauth.platform.intuit.com/oauth2/v1/tokens/bearer', //Example https://oauth.platform.intuit.com/oauth2/v1/tokens/bearer',
'client_id' => 'L0wfLei7A5qHX3OU62CU0DWMZyifQr6DINORlF4HdoyxQ36F8z', //Example 'Q0wDe6WVZMzyu1SnNPAdaAgeOAWNidnVRHWYEUyvXVbmZDRUfQ',
'client_secret' => '63NHnCNltXUXVo6RUFQADHKHcNSdDuPuwHCi0KmW', //Example 'R9IttrvneexLcUZbj3bqpmtsu5uD9p7UxNMorpGd',
'oauth_scope' => 'com.intuit.quickbooks.accounting', //Example 'com.intuit.quickbooks.accounting',
'openID_scope' => '', //Example 'openid profile email',
'oauth_redirect_uri' => 'https://qb.dagnum.com/test/OAuth2PHPExample.php', //Example https://d1eec721.ngrok.io/OAuth_2/OAuth2PHPExample.php',
'openID_redirect_uri' => '',//Example 'https://d1eec721.ngrok.io/OAuth_2/OAuthOpenIDExample.php',
'mainPage' => 'https://qb.dagnum.com/test', //Example https://d1eec721.ngrok.io/OAuth_2/index.php',
'refreshTokenPage' => 'https://qb.dagnum.com/test/RefreshToken.php', //Example https://d1eec721.ngrok.io/OAuth_2/RefreshToken.php'
)
?>
its so hard to debug as it doesnt give me a comprehensive error message.. just "We're sorry! We're experiencing some problems. Please try again later."
how do I fix this please
Ditto.
I'm having a similar issue. I was able to make requests via Postman using the my client_id and client_secret keys, but using the PHP sample just takes me to the (very) useless "Sorry. We're experiencing some problems" page.
Anyone?
Hi,
Did you add the redirect URL on your APP? You need to do it BEFORE you are using the Sample
See the attached picture:

@hlu2 Yes. redirect URL is there in the app setting per your screenshot. The same URL is being used in the config.php for the *_redirect_uri key.
@hlu2, got it working, but feeling like an idiot :/
I did have the redirect URL added to the list of Redirect URIs in my APP. BUT I only had the subdomain + domain part of the ngrok URL, i.e. https://xxxxxxxx.ngrok.io, and not the full URL, i.e. https://xxxxxxxx.ngrok.io/OAuth2PHPExample.php, as it was set up in my config.php. Your screenshot was the hint and I failed to see it until now. I'm not sure what made me think I did not need the full URL, filename included. So this sample app is working in my case, and my specific issue is resolved.
Perhaps this might be a hint to a solution for @m3Lvs too, assuming OP hasn't gotten their instance working yet.
I'll go back into my corner now.
I don't have the Redirect URIs section on the control panel/dashboard for my App. It should be on the Keys tab. I've tried creating new a new app and looking at old unused apps and none of them have a Redirect URIs section.
I too have this same issue; there are no Redirect URIs section listed; I have the correct URIs listed in Launch and Disconnect however it still only shows "We're sorry!" with no debug info.
Is it because "The certificate used to load https://appcenter.intuit.com/connect/oauth2 uses an SSL certificate that will be distrusted in Chrome 66" ?
If you have created your app before July.6th, 2017, you only have OAuth 1 keys, which will list as Consumer Key and Consumer Secret. The OAuth 1 app is not working with this example. Use the SDK instead: https://github.com/intuit/QuickBooks-V3-PHP-SDK