Sending response back to Fuse with Node.js auth

Hey there,
I’ve just picked up Fuse and am loving it so far. I’m trying to build an application with an authentication flow, using node.js with passport.js. After the authentication—which is with Instagram’s API—I re-direct the user back to the fuse app:

app.get('/auth/instagram/callback',
  passport.authenticate('instagram'),
  function(req, res) {
    console.log(res)
    res.redirect('my-fuse-app://');
  });

I am following the GitHub Authentication Example, which then extracts the code and requests from the Github API.
With this method, I launch with InterApp, which then runs the login flow in browser, and re-directs back to Fuse all smoothly. The problem is, I don’t know how to handle the response.

Is there a way to instead receive the response in Fuse and use the JSON object? Would websocket be an option here possibly, if set up in the app.js?

Thanks for any help!

Hi Nick,

you said The problem is, I don't know how to handle the response.

So if your interapp flow is working fine as you stated, then isn’t it as simple as implementing something similar like in the GitHub-example you linked, here? https://github.com/fusetools/fuse-samples/blob/master/Samples/GithubOAuth/MainView.js#L40

Specifically, that would be:

InterApp.onReceivedUri = function(uri) {
    // do something with the uri
};