undefined error on mobile app

ok, I just got invoice ninja 4.2.2 installed (self-hosted) and I wanted to get the invoice ninja android app working with the newly installed invoice ninja. I put the url in (http not https) and the API SECRET. I triple check to make sure that the key I put in the .env file matches the one in the mobile app. All I get is “Something went wrong, Undefined error occured”

Maybe the info here will help…

https://www.invoiceninja.com/forums/topic/api_secret-on-android-app/

ok, it might have something to do with how nginx is setup. If I got the my server url with just HTTP it gives me a “Welcome to NGINX” static page. I have to use https for in my browser to get to invoice ninja. However I can’t seem to get the android app to use HTTPS.

Can you post your nginx server block?

If you use https:// on the web, you will definitely need to use the same URL for the mobile app.

Another test would be to hit the PING URL from a browser to make sure the URL is valid goto:

https://your_url/api/v1/ping?api_secret=YOUR_SECRET

you should get a success message if the URL and api-secret is correct.

ok, I get an error message: “{“error”:{“message”:“Invalid token”}}”

This means you haven’t setup the secret token correctly in the .env file

follow these step:

http://docs.invoiceninja.com/en/latest/mobile_apps.html

The api-secret is the field you need to fill in both the .env file and on the settings page on the mobile device. The other tokens are generated by themselves.

I have, I tried to set it to 123456789 just to make sure it was correct. Still no dice and still same error.

I wonder if your nginx server config is not passing the variables across. can you post your virtual host server block?

I’m not sure how to get that. any suggestions? (I’m googling it, lol)

I think I have it…

server {
listen 80;
server_name [myipaddress];
add_header Strict-Transport-Security max-age=2592000;
rewrite ^ https://$server_name$request_uri? permanent;
}

server {
listen 443 default;
server_name [myipaddress];
ssl on;
ssl_certificate /etc/nginx/cert/ninja.crt;
ssl_certificate_key /etc/nginx/cert/ninja.key;
ssl_session_timeout 5m;
ssl_ciphers ‘AES128+EECDH:AES128+EDH:!aNULL’;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
root /var/www/html/ninja/public;
index index.html index.htm index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}

location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt  { access_log off; log_not_found off; }

# Access and Error Log for Invoice Ninja
access_log  /var/log/nginx/ininja.access.log;
error_log   /var/log/nginx/ininja.error.log;

sendfile off;

# Handle PHP Applications
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php-fpm-www-data.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors off;
fastcgi_buffer_size 16k;
fastcgi_buffers 4 16k;
}

location ~ /\.ht {
   deny all;
   }
}

the server block looks fine, can you send an email to contact@invoiceninja.com and we can debug further offline

try yourdomain.com/public