YetiForceCompany / YetiForceCRM

Our team created for you one of the most innovative CRM systems that supports mainly business processes and allows for customization according to your needs. Be ahead of your competition and implement YetiForce!
https://yetiforce.com
Other
1.72k stars 742 forks source link

REST API error 401 #12436

Closed dldnet closed 4 years ago

dldnet commented 4 years ago

Hi, I try to connect the REST API of YetiForce 5.2 self hosted I use yetirest.php from GitHub. I have defined the server and user properties image image

And here is the result of the script: image

I have searched in the issues and tried many options but nothing... always a 401 error

Do you have anything to try ?

Thanks in advance

mariuszkrzaczkowski commented 4 years ago

github

mariuszkrzaczkowski commented 4 years ago

Logs

dldnet commented 4 years ago

OS: CentOs 6.10 PHP 7.3 for both (YetiForce and therequesting script) Both on the same server to test

mariuszkrzaczkowski commented 4 years ago

screenshot of configuration verification

dldnet commented 4 years ago

image

dldnet commented 4 years ago

yetiforce_settings

mariuszkrzaczkowski commented 4 years ago

[webserviceErrors.log] [system.log] [webserviceDebug.log]

I don't know if it's a bug or a problem with my config. I didn't found any trace in the logs except 401 error. I am sure of my passwords (really simple passwords for testing)

send full logs to github@yetiforce.com, because they contain sensitive data

dldnet commented 4 years ago

mail sent. Thanks

rskrzypczak commented 4 years ago

I think that authorization header is not passed to PHP script Check: https://github.com/YetiForceCompany/YetiForceCRM/blob/developer/public_html/.htaccess#L21

dldnet commented 4 years ago

Thanks for the info. I have tried but nothing changed. Still 401 error, authorization problem

dldnet commented 4 years ago

Any idea ?

mariuszkrzaczkowski commented 4 years ago

The data in the authorization header is incorrect, enter the data from Web service - Applications instead of Web service - users

dldnet commented 4 years ago

That's exactly what I did since the beginning

dldnet commented 4 years ago

Ok, first problem found. Apache was dropping headers (including Authentication). It was due to server config. Now I have setup PHP-FPM on the YetiForce server and headers are well sent to php. No more 401 error... But now: Error 500 - internal server error And it is far more difficult to debug

mariuszkrzaczkowski commented 4 years ago

enable all logs and you'll see an error message

rskrzypczak commented 4 years ago

Enable https://github.com/YetiForceCompany/YetiForceCRM/blob/012eda20637db05d548f1ca173e21983e83a3ef0/config/Debug.php#L88

dldnet commented 4 years ago

I have already activated debug. When it is activated, no more error 500 (seems logical because the server answers something). But I receive a REST error empty/ This is what I see in the logs:

Status: 200 REQUEST_METHOD: POST REQUEST_URI: /webservice/Users/Login QUERY_STRING: module=Users&action=Login PATH_INFO: ----------- Response data ----------- Array ( [status] => 0 [error] => Array ( [message] => 2: openssl_public_encrypt() expects parameter 1 to be string, array given in //**/YetiForceCRM/api/webservice/Core/Response.php, line 132 [code] => 200 )

)

So, I tried to call the REST service via http (in place of https) but nothing changed.

mariuszkrzaczkowski commented 4 years ago

Wyłącz : config/Api.php public static $ENCRYPT_DATA_TRANSFER = false; https://github.com/YetiForceCompany/YetiForceCRM/blob/faf413c129205ac716431e5b3765474721e1db03/tests/setup/config/Api.txt#L38-L39

dldnet commented 4 years ago

Nice !!!! it seems to work now. Thank you very much for your help