Search code examples
facebookoauthionic-frameworkdreamfactory

How to add Dreamfactory OAuth facebook login in Ionic?


I am trying to implement Dreamfactory OAuth in Ionic app. I am following this resource for implementation: http://wiki.dreamfactory.com/DreamFactory/Tutorials/Using_OAuth

This is the call I am making:

$http.post('/api/v2/user/session?service=facebook').then(function (result) {
console.log("result: "+ JSON.stringify(result));
});

The log above shows me json data as it itself redirects to the facebook url returned by the call and it just returns HTML for that facebook page.

Is there a different approach I should be using in hybrid/Ionic apps for DF OAuth login?


Solution

  • Make that an Ajax call (or simply set request header [X-Requested-With: XMLHttpRequest]). This will return the actual URL that is needed, not the redirected response in html. Let me know if you have any questions.