dreamfactory: Missing email parameter after FB oauth_callback POST request

Hi,

I’m implementing FB OAuth login in self hosted DF instance. I’m following the tutorial linked here: http://wiki.dreamfactory.com/DreamFactory/Tutorials/Using_OAuth

When I make the API call to: POST https://your-url/api/v2/user/session?oauth_callback=true&{extracted_query_string_from_callback} I get status 400: {"error":{"code":400,"context":null,"message":"Login request is missing required email.","status_code":400}}

As far as I understand, I shouldn’t provide any email. It looks to me as if the request is misinterpreted as some another kind of login type.

Same issue is mentioned here but no response was given. http://community.dreamfactory.com/t/log-in-with-facebook-does-not-work/3480

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 19 (5 by maintainers)

Most upvoted comments

Ok to wrap it up. Yes, FB OAuth can work with native iOS App.

  1. You need to set the redirect URL in DF Oauth Service settings to fb<app_id>://authorize/
  2. The slash at the end is a MUST, otherwise FB thinks the redirect_URI is different than the first time and throws an error.
  3. The general flow is like that: 3.1 POST to df resource user/session?service=fb_oauth (add headers: X-Dreamfactory-API-Key: <df_api_key> X-Requested-With: XMLHttpRequest (this is to get json with FB url instead of being redirected) 3.2 Use the returned URL to open webview with FB auth screen 3.3 After successful login FB will redirect to fb<app-id>😕/authorize/<params>. You should react to that in you AppDelegate methods and retrieve all the params. NOTE: On success the params are ‘?’ and on failure with ‘#’. 3.3. POST to user/session?oauth_callback=true&<all params from fb> (there should be code and state) 3.4 You shoud get back session info from DF with session_token you can store and make next callbacks with it as a header or param.
  • All calls to DF should have the API key header set.
  • You may have to run ‘composer update’ for dreamfactory to get rid of access_tokenrelated error.

Thanks for all the help.

You can turn on debugging in your environment using the .env file that’s in the root directory of your DF installation. Set the following in your .env file

APP_DEBUG=true … DF_LOG_LEVEL=DEBUG

This should give you more details on the error with PHP stack trace.