diegogarciadev / android_snipeitapp_config

Automatic configuration of Android SnipeIT APP
30 stars 13 forks source link

Problem with api #13

Closed Paurek closed 3 years ago

Paurek commented 3 years ago

Hello,

I have a problem with the application, I generated an API key via the snipeit web interface and it is clearly visible with the link. But the app tells me 401: unauthorized. I do not understand why..

Thank you.

Paurek commented 3 years ago

Any idea ?

mvataleu commented 3 years ago

The same issue I have. Snipe-IT version 5.1.0

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Doneven2012 commented 3 years ago

I'm not completely sure that'd be the problem, but did you change the permissions on the file ? Make it, at least, readable so that the www-data user can read it. It's the default Apache user so I assume it has to be able to access it.

You can probably use a "sudo chmod 555 snipeitapp_config.php"

A 5 with permissions stands for "read and execute"

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

diegogarciadev commented 3 years ago

I'd like to investigate this issue, but I can't reproduce locally. Have someone solve this issue?

diegogarciadev commented 3 years ago

Hello,

I've found this info:

https://snipe-it.readme.io/docs/common-issues#401-unauthorized-error-on-api-calls

401 Unauthorized Error on API calls API tokens default to being valid for 40 years. If you run into this issue, you are most likely running a 32-bit version of PHP (which, why?). To work around this, in your .env, set API_TOKEN_EXPIRATION_YEARS to a smaller number, like 10 years.

Can you try it? @Paurek @mvataleu @Doneven2012

diegogarciadev commented 3 years ago

I will close this issue if nobody has this problem anymore