This is my scenario. A server in nodejs handles the authentication procedure while in the frontend we have angularjs. when the user clicks on the button, he signs in with Facebook then the server handles all the aspects of the authentication at the end redirect to the uri of the angularjs application. We have in the server something like that
module.exports = function(request, reply) {
if (request.auth.isAuthenticated) {
var profile = request.auth.credentials.profile.raw;
// set to cookie
request.auth.session.set(profile);
// Perform any account lookup or registration, setup local session,
// and redirect to the application. The third-party credentials are
// stored in request.auth.credentials. Any query parameters from
// the initial request are passed back via request.auth.credentials.query
// here we should redirect the app flow somewhere
return reply({ profile: profile.id }).redirect('http://localhost:8080/app');
}
return reply('Unauthorized').code(401);
};
My issue is that I don't know how to retrieve profile object in angularjs. I mean I know that exist $http
provider but in the following case the request doesn't start from angularjs. summering the flow the server reply with SPA if the user sign is successfully
Aucun commentaire:
Enregistrer un commentaire