Dreamfactory for Wordpress

I want to allow registered users of my Wordpress site to access data in my dreamfactory.com platform.

That means, a registered user has the ability to access more data (which resides on the DF-backend). There are different user-types (roles) on my Wordpress site.

How would I register a user on the DF-backend, when he/she registers on the Wordpress site?
How would I login from WordPress into the correct user on the DF-backend.

I could create complementary user-roles in DF and then access data using a user with that role (e.g. user: user_author or user_guest). But then I lose the ability to track, which individual user accesses data.

Did anybody try that already or has some ideas how to accomplish this?

You can do this. Here’s an overview of the approach.

My suggestion would be to duplicate the roles from your WordPress system into DreamFactory, and use the DreamFactory /user api to operate on users.

For example, when a user logs in to WordPress, check if the user is also in DreamFactory. If not, then create the user in DreamFactory and return a session token. If the user is already in DreamFactory, just return a session token.

Ideally, you want a plugin that hooks into the WordPress register/login/logout mechanism. You can store the session obtained from DreamFactory in the user metadata and when a user encounters a page that uses data from DreamFactory you can access that session ID and allow the page/app to make API calls to DreamFactory.

You could also have a UI component in the Wordpress plugin that allows manipulation of the mapping of roles. It’s OK to not have this UI if you’re dealing with just a few roles but mapping roles manually will be tedious and error prone for lots of roles.