microsoftgraph/php-connect-rest-sample

issue in outh.php

Closed this issue · 3 comments

after passing on my credentials and signing in ,i'm getting error in outh.php

Notice: Use of undefined constant clientId - assumed 'clientId' in C:\xampp\htdocs\project\microsoft\phpconnect\php-connect-rest-sample\app\oauth.php on line 34

Notice: Use of undefined constant clientSecret - assumed 'clientSecret' in C:\xampp\htdocs\project\microsoft\phpconnect\php-connect-rest-sample\app\oauth.php on line 35

Notice: Use of undefined constant redirectUri - assumed 'redirectUri' in C:\xampp\htdocs\project\microsoft\phpconnect\php-connect-rest-sample\app\oauth.php on line 36

Notice: Use of undefined constant urlAuthorize - assumed 'urlAuthorize' in C:\xampp\htdocs\project\microsoft\phpconnect\php-connect-rest-sample\app\oauth.php on line 37

Notice: Use of undefined constant urlAccessToken - assumed 'urlAccessToken' in C:\xampp\htdocs\project\microsoft\phpconnect\php-connect-rest-sample\app\oauth.php on line 38

Notice: Use of undefined constant urlResourceOwnerDetails - assumed 'urlResourceOwnerDetails' in C:\xampp\htdocs\project\microsoft\phpconnect\php-connect-rest-sample\app\oauth.php on line 39

Notice: Use of undefined constant scopes - assumed 'scopes' in C:\xampp\htdocs\project\microsoft\phpconnect\php-connect-rest-sample\app\oauth.php on line 40

Notice: Use of undefined constant code - assumed 'code' in C:\xampp\htdocs\project\microsoft\phpconnect\php-connect-rest-sample\app\oauth.php on line 65

Fatal error: Uncaught exception 'GuzzleHttp\Exception\RequestException' with message 'cURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)' in C:\xampp\htdocs\project\microsoft\phpconnect\php-connect-rest-sample\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php:187 Stack trace: #0 C:\xampp\htdocs\project\microsoft\phpconnect\php-connect-rest-sample\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php(150): GuzzleHttp\Handler\CurlFactory::createRejection(Object(GuzzleHttp\Handler\EasyHandle), Array) #1 C:\xampp\htdocs\project\microsoft\phpconnect\php-connect-rest-sample\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php(103): GuzzleHttp\Handler\CurlFactory::finishError(Object(GuzzleHttp\Handler\CurlHandler), Object(GuzzleHttp\Handler\EasyHandle), Object(GuzzleHttp\Handler\CurlFactory)) #2 C:\xampp\htdocs\project\microsoft\phpconnect\php-connect-rest-sample\vendor\guzzlehttp\guzzle\src\Handler\CurlHandler.php(43): GuzzleHttp\Handler\CurlF in C:\xampp\htdocs\project\microsoft\phpconnect\php-connect-rest-sample\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php on line 187

could you please help

Hi @cliffon . Thanks for reporting this issue. Did you try this troubleshooting step from the readme? If not, can you please try it?

Error: Unable to get local issuer certificate

You receive the following error after providing your credentials to the sign in page.
SSL certificate problem: unable to get local issuer certificate

cURL can't verify the validity of the Microsoft certificate when trying to issue a request call to get tokens. You must configure cURL to use a certificate when issuing https requests by following these steps:

  1. Download the cacert.pem file from cURL website.
  2. Open your php.ini file and add the following line
    curl.cainfo = "path_to_cacert/cacert.pem"
    

I offered a pull request to fix the "Use of undefined constant" notices and it was merged in yesterday, so that should be fixed.

Thanks again for reporting this issue, @cliffon ! Please reopen if you're still running into this.
Thanks again @schinkel for fixing!