Snipe-it: API Key generation error

Created on 16 Feb 2018  路  10Comments  路  Source: snipe/snipe-it

Expected Behavior (or desired behavior if a feature request)

Generate API key via SnipeIT GUI


Actual Behavior

I am unable to generate a new token under the Personal API Keys page (https://snipeit.myserver/snipeit/account/api)
When I press create toke after entering the user I get the following error "Whoops! Something went wrong! Please try again."
"An Error has occured! Trying to get property of non-object"

I did the same through command line by php artisan passport:client --personal and again, I get an error.

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'snipeit.oauth_clients' doesn't exist (SQL: insert intooauth_clients(user_id,name,secret,re
direct,personal_access_client,password_client,revoked,updated_at,created_at) values (, test, tPAYeM2o0WeW7ZXLQHwc4ZFcT4Nn4zsnDSjfYIjU, http://local host, 1, 0, 0, 2018-02-16 12:31:14, 2018-02-16 12:31:14))

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'snipeit.oauth_clients' doesn't exist


Please confirm you have done the following before posting your bug report:


Provide answers to these questions:

  • Is this a fresh install or an upgrade? FRESH
  • Version of Snipe-IT you're running v4.1.10 - build 3249
  • Version of PHP you're running PHP 5.6.31
  • Version of MySQL/MariaDB you're running mysql Ver 15.1 Distrib 5.5.52-MariaDB,
  • What OS and web server you're running Snipe-IT on Red Hat 4.8.5-11
  • What method you used to install Snipe-IT (install.sh, manual installation, docker, etc) manual installation
  • WITH DEBUG TURNED ON, if you're getting an error in your browser, include that error
  • What specific Snipe-IT page you're on, and what specific element you're interacting with to trigger the error https://snipeit.myserver/snipeit/account/api ----> create new token
  • If a stacktrace is provided in the error, include that too.
  • Any errors that appear in your browser's error console.
    api:1 The SSL certificate used to load resources from https://snipeit.myserver will be distrusted in M70. Once distrusted, users will be prevented from loading these resources. See https://g.co/chrome/symantecpkicerts for more information.
    /snipeit/oauth/personal-access-tokens Failed to load resource: the server responded with a status of 500 (Internal Server Error)
    api:1 Uncaught (in promise

  • Confirm whether the error is reproducible on the demo: https://snipeitapp.com/demo.
    No, it is not as the API generation is not available in the demo

  • Include any additional information you can find in storage/logs and your webserver's logs.
  • Include what you've done so far in the installation, and if you got any error messages along the way.
  • Indicate whether or not you've manually edited any data directly in the database : NO

  • Please do not post an issue without answering the related questions above. If you have opened a different issue and already answered these questions, answer them again, once for every ticket. It will be next to impossible for us to help you.

https://snipe-it.readme.io/docs/getting-help

Most helpful comment

To be honest, nothing in particular. I can't understand why, but now I am able to generate APi keys from both command line and GUI.
Sorry that I can't provide you with a better understanding of the situation. I will let you know if I discover something.
Thanks again.

All 10 comments

https://snipe-it.readme.io/docs/installation-issues#section-base-table-or-view-not-found-1146-table-oauth_clients-doesnt-exist

Thanks. But I have already created assets in the DB. The php artisan migrate command will destroy and re create everything or just the missing tables?
Thanks Again

Just missed tables.

`************

  • Application In Production! *

Do you really wish to run this command? (yes/no) [no]:

yes

Nothing to migrate.
`

Does that table exist?

Here you have the list of tables. oauth_clients is present. Something that I haven't mentioned is that the DB is located in a different server.

MariaDB [snipeit]> show tables;
+-------------------------------+
| Tables_in_snipeit |
+-------------------------------+
| accessories |
| accessories_users |
| action_logs |
| asset_logs |
| asset_maintenances |
| asset_uploads |
| assets |
| categories |
| checkout_requests |
| companies |
| components |
| components_assets |
| consumables |
| consumables_users |
| custom_field_custom_fieldset |
| custom_fields |
| custom_fieldsets |
| departments |
| depreciations |
| groups |
| imports |
| license_seats |
| licenses |
| locations |
| manufacturers |
| migrations |
| models |
| oauth_access_tokens |
| oauth_auth_codes |
| oauth_clients |
| oauth_personal_access_clients |
| oauth_refresh_tokens |
| password_resets |
| requested_assets |
| requests |
| settings |
| status_labels |
| suppliers |
| throttle |
| users |
| users_groups |
+-------------------------------+

I'm now able to generate API keys.
Thank you!

What did you do to resolve this?

To be honest, nothing in particular. I can't understand why, but now I am able to generate APi keys from both command line and GUI.
Sorry that I can't provide you with a better understanding of the situation. I will let you know if I discover something.
Thanks again.

Just wanted to say that I've experienced the exact same issue. The only thing I did was to log on to the database server and queried the _oauth_ tables (I could only find the personal client with the _secret_ not being in the proper token format).
Afterwards I was able to use the GUI to create the token.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

snipe picture snipe  路  3Comments

ArchdukeNavaron picture ArchdukeNavaron  路  4Comments

Supsuop picture Supsuop  路  4Comments

memtech3 picture memtech3  路  4Comments

Rungea96 picture Rungea96  路  4Comments