So what happens if you make a mistake and expose your admin app api_key or just need to change api_key associated with one of your apps? We have an easy workaround that doesn’t require you to have to change any of your endpoints or having to recreate an app, etc. This article shows you how to access all of your app API keys via MySQL or, if you haven’t fully started exploring DreamFactory yet, the default SQLite database.
Use the following commands:
With this newly created API
I use MySQL Workbench, but there are plenty of alternatives. Connect to your database, and you can see the apps in your DreamFactory instance. You can always use the following command to see them:
You can now update the api_key slot using this command:
UPDATE app SET api_key = "1e4adbadb2664a948f1ce0f2490d4448bffb4eb11e3162f88a4da655ec9826d8" WHERE id = 1;
Here is a link to some SQL instructions if you are looking for other options to modify tables or data.
SQLite functions very similarly and you can access the prompts via your terminal session. The issue there is that it doesn’t look as “pretty” as the MySQL dev tools, but the data is organized in the same way.
Depending on your install you need to get into the databases directory. In these screenshots I have spun up a locally hosted, Github install. My path is:
To enter the terminal:
➜ databases git:(83aecfe) ✗ sqlite3
This will get you into the sqlite prompt so that you can access your database.
SQLite version 3.16.0 2016-11-04 19:09:39 Enter ".help" for usage hints. Connected to a transient in-memory database. Use ".open FILENAME" to reopen on a persistent database. sqlite>
You can now grab access to the apps and their details.
sqlite> .open df-test sqlite> select * from app; 1|admin|6498a8ad1beb9d84d63035c5d1120c007fad6de706734db9689f8996707e0f7d|An application for administering this instance.|1|3|dreamfactory/dist/index.html||||0|1|top||2018-03-04 07:12:45|2018-03-20 15:20:56||1 2|api_docs|36fda24fe5588fa4285ac6c6c2fdfbdb6b6bc9834699774c9bf777f706d05a88|An OpenAPI-based application allowing documentation viewing and testing of the API.|1|3|df-api-docs-ui/dist/index.html||||0|1|top||2018-03-04 07:12:45|2018-03-04 07:12:45|| 3|file_manager|b5cb82af7b5d4130f36149f90aa2746782e59a872ac70454ac188743cb55b0ba|An application for managing file services.|1|3|filemanager/index.html||||0|1|top||2018-03-04 07:12:45|2018-03-04 07:12:45|| 4|Address Book for React|91a8fdf7d133939a3a43b4940615bc3ff7432456b2309472152a394d613ab22c|An address book app for React showing user registration, user login, and CRUD.|1|1|add_reactjs/public/index.html|index.html|3|AddressBookForReact|0|1|top|1|2018-03-15 19:02:57|2018-03-15 19:03:35|1|1 sqlite>
Like I said a little messy looking, but the columns are the same as if you were in MySQL. Use the same set of commands as you would in the above SQL example to update any of the records you need to. You can access all of the CLI commands you need for SQLite here.
And you are now off and running again. Remember, if you need any help at all, please reach out to us at [email protected].