I have a single page web app in Node.js/Express and Angular.js and I need to use the Jawbone API to retrieve fitness data. In order to use their API I need to be redirected to the Jawbone website to authenticate and provide a callback URL to receive the fitness data. I'm implementing the code in the following tutorial but this is not designed as a single page app. Rather a separate route (/sleepdata
) is provided for the callback which is rendered to a 'userdata.ejs
' page...
app.get('/login/jawbone',
passport.authorize('jawbone', {
scope: ['basic_read','sleep_read'],
failureRedirect: '/'
})
);
app.get('/sleepdata',
passport.authorize('jawbone', {
scope: ['basic_read','sleep_read'],
failureRedirect: '/'
}), function(req, res) {
res.render('userdata', req.account);
}
);
Is there a way to adapt this code so the jawbone account data can be retrieved by my Angular SPA, rather than implementing a separate route for the callback?