How to implement OAuth via Facebook mobile app



Hi all,

We developed a hybrid mobile application as front-end integrated with a DreamFactory 2.2.1 back-end, which includes a Facebook OAuth service configured as explained in the tutorial (using web redirection). With this setup social authentication works fine.

Now we would like to use the native Facebook app installed on the mobile device (instead of a web browser) to authenticate our users against our DF backend, but we don’t find how to implement the auth process.

For example using cordova-plugin-facebook4 it’s pretty straightforward to get a FB accessToken via the native FB app, but the API of DF expects an authorization code to obtain the accessToken by itself (according to the tutorial). It seems not possible to get an authorization code using the native FB app, so my question is the following:

Is it possible to perform the OAuth process in DF using an accessToken instead of the authorization code?

It seems that according to the source code, either the DF FB service requests the authorization code via web redirection or directly redirects to the login page.

These are the specific versions we’re using:
DreamFactory Version: 2.2.1
dreamfactory/df-core 0.3.3
dreamfactory/df-oauth 0.3.1
aravel/framework v5.2.45
laravel/socialite v2.0.21

Any thoughts on this?

Thanks in advance for your help.


I found that there’s a userFromToken function in laravel/socialite which may be useful for our purposes. Nevertheless it seems it’s not used by DreamFactory. Is it correct, @mattschaer?

Perhaps this is something already implemented in newer versions of DF or in the roadmap for future versions, @benbusse?