My Environment
PHP 7.0
MySQL 5.6
CentOS 6.9
Apache 2.4
SuiteCRM 7.10.4
If anyone have a solution or having a similar experience, please let me know. Iāve listed all the relevant information below I that I have investigated trying to fix this issue. I donāt have any error messages in Apache Error Logs pertaining to this issue.
Iām receiving the following error message in the suitecrm.log when I try to invoke the version 8 of the APIs:
[-none-][FATAL] [ERROR] [ResourceServer] Code: 9 Message: The resource owner or authorization server denied the request. ErrorType: access_denied Hint: Missing āAuthorizationā header
This is the error message I get in the error.log:
[22-May-2018 12:23:14 America/New_York] PHP Fatal error: Uncaught RuntimeException: Unexpected data in output buffer. Maybe you have characters before an opening <?php tag? in //vendor/slim/slim/Slim/App.php:604
Stack trace:
#0 //vendor/slim/slim/Slim/App.php(316): Slim\App->finalize(Object(Slim\Http\Response))
#1 //lib/API/core/app.php(83): Slim\App->run()
#2 //lib/API/public/index.php(5): require_once(ā/home/hhadmin/aā¦ā)
#3 {main}
thrown in //vendor/slim/slim/Slim/App.php on line 604
Iām following the example code but have tweak it since it had some coding errors: This is the code:
<?php $ch = curl_init(); $header = array( 'Content-type: applicatoin/vnd.api+json', 'Accept: application/vnd.api+json', ); $postStr = json_encode(array( 'grant_type' => 'client_credentials', 'client_id' => 'removed-b9b9-ded8-c2e0-removed', 'client_secret' => '', 'scope' => 'standard:create standard:read standard:update standard:delete stand:relationship:create standard:relationship:read standard:relationship:update standard;relationship:delete' )); $url = 'https:///api/oauth/access_token'; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST'); curl_setopt($ch, CURLOPT_POSTFIELDS, $postStr); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, $header); $output = curl_exec($ch); echo "the response(output):\n"; print($output); $txt ="\ncompleted\n"; echo $txt; print($url); echo "\n"; print($postStr); print("\n\n") ?>Iāve also checked my .htaccess file to ensure the api mods were correct. This is what I have:
BEGIN SUGARCRM RESTRICTIONS
RedirectMatch 403 (?i)..log$
RedirectMatch 403 (?i)/+not_imported_..txt
RedirectMatch 403 (?i)/+(soap|cache|xtemplate|data|examples|include|log4php|metadata|modules)/+..(php|tpl)
RedirectMatch 403 (?i)/+emailmandelivery.php
RedirectMatch 403 (?i)/+upload
RedirectMatch 403 (?i)/+cache/+diagnostic
RedirectMatch 403 (?i)/+files.md5$
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule ^cache/jsLanguage/(ā¦_ā¦).js$ index.php?entryPoint=jslang&modulename=app_strings&lang=$1 [L,QSA]
RewriteRule ^cache/jsLanguage/(\w)/(ā¦ā¦).js$ index.php?entryPoint=jslang&modulename=$1&lang=$2 [L,QSA]
RewriteRule ^cache/jsLanguage/(ā¦ā¦).js$ index.php?entryPoint=jslang&module=app_strings&lang=$1 [L,QSA]
RewriteRule ^cache/jsLanguage/(\w*)/(ā¦_ā¦).js$ index.php?entryPoint=jslang&module=$1&lang=$2 [L,QSA]
RewriteRule ^api/(.?)$ lib/API/public/index.php/$1 [L]
RewriteRule ^api/(.)$ - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
END SUGARCRM RESTRICTIONS
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://myurl-removed.com