Jump to content


API Login failure


  • Please log in to reply
2 replies to this topic

#1 Mathieu



  • Members
  • Pip
  • 1 posts

Posted 18 February 2014 - 05:17 PM

Hi, new here! 


I'm trying to log into my Zurmo installation via API, but always get 'Invalid username or password' response. I use the suggested ApiRestHelper Class and the login function described in the wiki.


My username and password are good, so I looked at apiController->actionLogin function and var_dumped Yii::app()->apiRequest->getUsername();


It is empty. It shouldn't as I send both username and password in header like wiki: 

$headers = array(
  'Accept: application/json',
  'ZURMO_AUTH_USERNAME: ' . $username,
  'ZURMO_AUTH_PASSWORD: ' . $password,

I also tried another rest client and filled in the request (https://code.google.com/p/rest-client/) and got the same results.


Can you see any reason why getUsername returns null?


Thanks for your help,



Mathieu Hamel


#2 eminic



  • Members
  • Pip
  • 1 posts

Posted 11 April 2014 - 09:56 AM

I hope my answer will help because I spent hours try go around this problem. This is your server configuration.


To get username from an API call, Zurmo is calling a PHP function: 


This function is supposed to be available in PHP 5.4 if you use mod_php or fastCGI. Therefore, if you use PHP 5.4, it shouldn't be an issue. 


However, if your server is configured to use php-fpm, there's a bug so that getallheaders() cannot be accessed. Here's the bug: https://bugs.php.net/bug.php?id=62596


How do you know what your server configuration is? Just run phpinfo() and go to the line: "Server API". 


My server was configured to use php-fpm. So, to fix this issue, I changed my Apache configuration to use mod_php:

  1. Go to httpd.conf
  2. Uncomment: LoadModule php5_module        modules/libphp5.so

That should be enough. However, there's one more thing that I did because libphp5 so is not compatible with mod_mpm_event.

  1. Uncomment: LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
  2. Comment: #LoadModule mpm_event_module modules/mod_mpm_event.so


And that's all. Now it works. 


#3 AceNik



  • Members
  • Pip
  • 1 posts
  • LocationMumbai

Posted 11 March 2015 - 06:34 PM

If using nginx on ubuntu or linux:


Forget all of the above simply do the following:


1. Edit the file for NGINX conf file:

sudo nano /etc/nginx/nginx.conf

2. Add the following to it:

underscores_in_headers on;

3. Restart NGINX:

sudo service nginx restart

Thats it, all issues would be solved!


Read more on additional headers related information with Nginx and Zurmo



Also tagged with one or more of these keywords: API

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users