API V8 - server response 500, problem with OAuth2 token

Hi, here is the case :slight_smile:

Fresh installation in AWS cloud using Bitnami SuiteCRM. Everything works fine but not API.
All steps checked with GUIDE

When I call endpoint

https://xxx.xxx.xxx.xxx/Api/access_token

I get 500 response with:

{“error”:“unknown_error”,“message”:"It was not possible to parse your key, reason: "}

There are no errors in Apache error_log.
Here is dump from suitecrm.log

Tue Nov 22 10:57:44 2022 [3390][-none-][DEBUG] Hook called: OAuth2Clients::before_retrieve
Tue Nov 22 10:57:44 2022 [3390][-none-][DEBUG] Retrieve OAuth2Clients : SELECT oauth2clients.* FROM oauth2clients WHERE oauth2clients.id = ‘43c68236-a52e-12ac-0108-637ca367a023’ AND oauth2clients.deleted=0
Tue Nov 22 10:57:44 2022 [3390][-none-][DEBUG] Limit Query:SELECT oauth2clients.* FROM oauth2clients WHERE oauth2clients.id = ‘43c68236-a52e-12ac-0108-637ca367a023’ AND oauth2clients.deleted=0 Start: 0 count: 1
Tue Nov 22 10:57:44 2022 [3390][-none-][INFO] Query:SELECT oauth2clients.* FROM oauth2clients WHERE oauth2clients.id = ‘43c68236-a52e-12ac-0108-637ca367a023’ AND oauth2clients.deleted=0 LIMIT 0,1
Tue Nov 22 10:57:44 2022 [3390][-none-][INFO] Query Execution Time:0.00023603439331055
Tue Nov 22 10:57:44 2022 [3390][-none-][DEBUG] get_user_array query: SELECT id, first_name, last_name, user_name FROM users WHERE 1=1 ORDER BY user_name ASC
Tue Nov 22 10:57:44 2022 [3390][-none-][INFO] Query:SELECT id, first_name, last_name, user_name FROM users WHERE 1=1 ORDER BY user_name ASC
Tue Nov 22 10:57:44 2022 [3390][-none-][INFO] Query Execution Time:0.00012993812561035
Tue Nov 22 10:57:44 2022 [3390][-none-][DEBUG] Hook called: OAuth2Clients::after_retrieve
Tue Nov 22 10:57:44 2022 [3390][-none-][DEBUG] Hook called: OAuth2Tokens::before_save
Tue Nov 22 10:57:44 2022 [3390][-none-][INFO] Query:INSERT INTO oauth2tokens (id,name,date_entered,date_modified,deleted,token_is_revoked,token_type,access_token_expires,access_token,grant_type,client,assigned_user_id)
VALUES (‘6e55674f-6e36-19df-0460-637cab39502e’,’’,‘2022-11-22 10:57:44’,‘2022-11-22 10:57:44’,0,0,’’,‘2022-11-22 11:57:44’,‘8ea3705187dcb239caa9582aea739cb6e4b657e271b3b8867a7b5cc9b5c317bad605fbe7ece2e9a8’,’’,‘43c68236-a52e-12ac-0108-637ca367a023’,‘6ff18e1b-a2bd-09bd-d9bd-637caab54b15’)
Tue Nov 22 10:57:44 2022 [3390][-none-][INFO] Query Execution Time:0.0042288303375244
Tue Nov 22 10:57:44 2022 [3390][-none-][DEBUG] SecuritySuite: Get SecuritySuite Enabled Modules: SELECT lhs_module, rhs_module FROM relationships WHERE deleted=0 AND (lhs_module = ‘SecurityGroups’ OR rhs_module=‘SecurityGroups’)
Tue Nov 22 10:57:44 2022 [3390][-none-][INFO] Query:SELECT lhs_module, rhs_module FROM relationships WHERE deleted=0 AND (lhs_module = ‘SecurityGroups’ OR rhs_module=‘SecurityGroups’)
Tue Nov 22 10:57:44 2022 [3390][-none-][INFO] Query Execution Time:0.00080585479736328
Tue Nov 22 10:57:44 2022 [3390][-none-][DEBUG] SecuritySuite: Get SecuritySuite Enabled Modules: SELECT lhs_module, rhs_module FROM relationships WHERE deleted=0 AND (lhs_module = ‘SecurityGroups’ OR rhs_module=‘SecurityGroups’)
Tue Nov 22 10:57:44 2022 [3390][-none-][INFO] Query:SELECT lhs_module, rhs_module FROM relationships WHERE deleted=0 AND (lhs_module = ‘SecurityGroups’ OR rhs_module=‘SecurityGroups’)
Tue Nov 22 10:57:44 2022 [3390][-none-][INFO] Query Execution Time:0.00032901763916016
Tue Nov 22 10:57:44 2022 [3390][-none-][DEBUG] SecuritySuite: Get SecuritySuite Enabled Modules: SELECT lhs_module, rhs_module FROM relationships WHERE deleted=0 AND (lhs_module = ‘SecurityGroups’ OR rhs_module=‘SecurityGroups’)
Tue Nov 22 10:57:44 2022 [3390][-none-][INFO] Query:SELECT lhs_module, rhs_module FROM relationships WHERE deleted=0 AND (lhs_module = ‘SecurityGroups’ OR rhs_module=‘SecurityGroups’)
Tue Nov 22 10:57:44 2022 [3390][-none-][INFO] Query Execution Time:0.00074315071105957
Tue Nov 22 10:57:44 2022 [3390][-none-][DEBUG] SecuritySuite: Get SecuritySuite Enabled Modules: SELECT lhs_module, rhs_module FROM relationships WHERE deleted=0 AND (lhs_module = ‘SecurityGroups’ OR rhs_module=‘SecurityGroups’)
Tue Nov 22 10:57:44 2022 [3390][-none-][INFO] Query:SELECT lhs_module, rhs_module FROM relationships WHERE deleted=0 AND (lhs_module = ‘SecurityGroups’ OR rhs_module=‘SecurityGroups’)
Tue Nov 22 10:57:44 2022 [3390][-none-][INFO] Query Execution Time:0.00010585784912109
Tue Nov 22 10:57:44 2022 [3390][-none-][DEBUG] Hook called: OAuth2Tokens::after_save
Tue Nov 22 10:57:44 2022 [3390][-none-][DEBUG] Creating new instance of hook class AOD_LogicHooks without parameters
Tue Nov 22 10:57:44 2022 [3390][-none-][DEBUG] Hook called: AOD_Index::before_retrieve
Tue Nov 22 10:57:44 2022 [3390][-none-][DEBUG] Retrieve AOD_Index : SELECT aod_index.* FROM aod_index WHERE aod_index.id = ‘1’ AND aod_index.deleted=0
Tue Nov 22 10:57:44 2022 [3390][-none-][DEBUG] Limit Query:SELECT aod_index.* FROM aod_index WHERE aod_index.id = ‘1’ AND aod_index.deleted=0 Start: 0 count: 1
Tue Nov 22 10:57:44 2022 [3390][-none-][INFO] Query:SELECT aod_index.* FROM aod_index WHERE aod_index.id = ‘1’ AND aod_index.deleted=0 LIMIT 0,1
Tue Nov 22 10:57:44 2022 [3390][-none-][INFO] Query Execution Time:0.00014805793762207
Tue Nov 22 10:57:44 2022 [3390][-none-][DEBUG] SugarBean[AOD_Index].load_relationships, Loading relationship (assigned_user_id).
Tue Nov 22 10:57:44 2022 [3390][-none-][DEBUG] SugarBean.load_relationships, failed Loading relationship (assigned_user_id)
Tue Nov 22 10:57:44 2022 [3390][-none-][DEBUG] SugarBean[AOD_Index].load_relationships, Loading relationship (assigned_user_id).
Tue Nov 22 10:57:44 2022 [3390][-none-][DEBUG] SugarBean.load_relationships, failed Loading relationship (assigned_user_id)
Tue Nov 22 10:57:44 2022 [3390][-none-][DEBUG] Hook called: AOD_Index::after_retrieve
Tue Nov 22 10:57:44 2022 [3390][-none-][DEPRECATED] AOD Lucene search is deprecated since v7.12.0
Tue Nov 22 10:57:44 2022 [3390][-none-][DEBUG] Creating new instance of hook class SuiteCRM\Search\ElasticSearch\ElasticSearchHooks without parameters
Tue Nov 22 10:57:44 2022 [3390][-none-][DEBUG] Creating new instance of hook class AssignGroups without parameters
Tue Nov 22 10:57:44 2022 [3390][-none-][DEBUG] Creating new instance of hook class AOW_WorkFlow without parameters
Tue Nov 22 10:57:44 2022 [3390][-none-][INFO] Query:SELECT id FROM aow_workflow WHERE aow_workflow.flow_module = ‘OAuth2Tokens’ AND aow_workflow.status = ‘Active’ AND (aow_workflow.run_when = ‘Always’ OR aow_workflow.run_when = ‘On_Save’ OR aow_workflow.run_when = ‘Create’) AND aow_workflow.deleted = 0
Tue Nov 22 10:57:44 2022 [3390][-none-][INFO] Query Execution Time:0.00025796890258789
Tue Nov 22 10:57:44 2022 [3390][-none-][DEBUG] Hook called: ::server_round_trip
Tue Nov 22 10:57:44 2022 [3390][-none-][DEBUG] Calling MySQLi::disconnect()

Where should I look for error?

BTW. When I use “wrong” credentials I get:
for wrong client id (error 500)
{"error":"unknown_error","message":"OAuth2Clients module with id 43c68236-a52e-12ac-0108-637ca367a023a is not found"}

for wrong client_secret (error 401)
{"error":"invalid_client","message":"Client authentication failed"}

So this API works fine, there is some server processing problem.