Auth via External DB


#1

I am using DF 2.0 in Amazon instance. I have RDS which has mysql DB. How can i store users, roles and all DB operations in my external DB…


#2

HI there, I think that I am having the same issue as Mohammed.

I am new to DreamFactory and there is something I don’t quite understand.

I already have a users and user roles table in my external DB that I would like to use to authenticate users against - is this possible? Do I have to use linked keys? If someone could point us in the right direction that would be great.

Thanks in advance - and sorry if I am hijacking this thread instead of aiding it…


#3

Any answers that can help me


#4

Above where I said “linked keys” I meant lookup keys. I think the answer can be found using those - at least that is what an intro video seemed to suggest.

I think that you really need to let DreamFactory handle the users table and then you can have your user data in another column in your own DB. I am still figuring this out myself so I will keep you posted when I figure more out but I hope that can at least help a little bit.


#5

If the original question is just using an external db for the system db, that is pretty simple.
In the root directory of your install there is a .env file. You will need to edit this file. By default the database section looks like this:

##------------------------------------------------------------------------------
## Database Settings
##------------------------------------------------------------------------------

DB_DRIVER=sqlite
DB_HOST=localhost
DB_DATABASE=dreamfactory
DB_USERNAME=df_admin
DB_PASSWORD=df_admin
DB_PORT=3306

Change the driver to mysql and fill out the rest of the information according to your specific database.

Then you will need to re-run the setup. You can do this from the command line. Navigate to the root of the install directory (where the .env file is).
Clear the cache:

$ php artisan cache:clear

Then run the DreamFactory setup (this runs migrations, seeds the database, and sets up the admin user.)

$ php artisan dreamfactory:setup

Restart Apache (or whatever your web server is running.)


#6

as far as @Jonathan_Irwin’s question I don’t believe this explicitly supported, though you may be able to make it work.


#7

Hey Drew

Thanks for the reply. In fact I think that the info above will really help me out.
I’m not desperate to move the other fields to my own external DB, but it is nice that I can manage them in another remote DB…


#8

Thanks @drewpearce

This is what I was looking for. Great :slight_smile:


#10

Hi again,

Am I right to assume that using sqlsrv here with the right credentials would allow me to install the system db to a remote MS sql server?

After trying for a while I can’t get past this error:
SQLSTATE[01002] Adaptive Server connection failed (severity 9)

edit:
I see here that it is supported. Are there any more steps to get it to work? The db is accessible remotely


#11

No, Microsoft SQL Server is not supported for the DreamFactory system DB. Forum link here.

Note that the ‘sqlsrv’ option has already been removed from the DreamFactory setup command. We had just neglected to also remove it from the readme.


#12

Cool, thanks for letting me know… :slight_smile:


#13

Hello,

is there any update on the possibility to authenticate based on existing username/password store in external RDMS? Is this possible with lookup keys? It would seem that this should be possible one way or another, just not sure how.

thanks