ictinnovations / ictcore

ICTCore: Unified Communications Framework for web developers. Communications APIs for voice calls, SMS messaging, Fax communications and Emails
http://ictcore.org/
Mozilla Public License 2.0
21 stars 16 forks source link

Unable to authenticate with api #6

Closed bingomate closed 6 years ago

bingomate commented 6 years ago

POST to /api/authenticate yield a 500 internal server error. Using applicaton/json as Content-Type and the following formatted JSON

{
  "username": "user",
  "password": "pass"
}

Apache logs are showing:

[Thu Jun 21 21:27:57.021852 2018] [:error] [pid 8159] [client 192.168.1.253:36014] PHP Warning:  error_log(/usr/ictcore/log/ictcore.log): failed to open stream: Permission denied in /usr/ictcore/core/lib/Corelog.php on line 87
[Thu Jun 21 21:27:57.021913 2018] [:error] [pid 8159] [client 192.168.1.253:36014] PHP Fatal error:  Call to a member function generate_token() on a non-object in /usr/ictcore/core/Api/Authenticate.php on line 53

I followed the installation guide from http://www.ictdialer.org/installation-guide running on CentOS 7 (64) and referenced the API guide from https://github.com/ictinnovations/ictcore/blob/master/docs/ApiGuide.md

On a side note, I checked the generate_token() method from /ictcore/core/User.php and noticed it was looking for a private key on a path that doesn't seem to exist

 public function generate_token()
  {
    $key_file = Conf::get('security:private_key', '/usr/ictbroadcast/etc/ssh/ib_node');
    $private_key = file_get_contents($key_file);

Should /usr/ictbroadcast/etc/ssh/ib_node be actually pointing to /usr/ictcore/etc/ssh/ib_node ?

Would very much appreciate the help. Cheers!

tahiralmas commented 6 years ago

Thanks for pointing out the mistake. However other then changing this line you also need to allow write permission on /usr/ictcore/log. It will allow ICTCore to reveal actual error under this directly.

Please provide us error logs from /usr/ictcore/log directory for further help

bingomate commented 6 years ago

So the permissions on the log file seem to have r/w permissions and I see other log entries in there

[root@osboxes log]# ls -la
total 20
drwxrwsr-x+  2 ictcore ictcore    43 Jun 21 17:10 .
drwxr-xr-x. 13 ictcore ictcore   270 Jun 21 17:09 ..
-rw-rw-r--.  1 ictcore ictcore    71 Feb 13 05:22 .gitignore
-rw-rw-r--.  1 ictcore ictcore 15142 Jun 21 19:06 ictcore.log
tahiralmas commented 6 years ago

You were supposed to find and share the error from thous entries

tail ictcore.log

bingomate commented 6 years ago

Thanks for the responses. I figured out what I was doing wrong. I was using email format for username instead of just entering the username without domain