Logging the user using custom made external api


#1

I am building a Meteor app that uses my website login API (built in php) to check if a user is on my website database or not. So using meteor HTTP.post I send user email and password as params, and my website API returns a json with a success or failure message, and that is it.

What I am not being able to do is to, as according to this success message, “login” the user on my Meteor app without creating/checking Users collection from accounts.

So it should be: return success? You are logged in. No users.insert, nor anything like that. Is it possible to be done?

To make this API call, I have created a method, activated here:

Meteor.call(‘loginUser’, userData, function(error, result){
if(error)
console.log(error.reason);
else(console.log(result))

if (result.status == 'ok') {
    Session.set('loginStatus', 'loggedUser');
    Router.go('/');
}

});

I am using this Session.set only to simulate what I am expecting to happen. But using Session is certainly not the best option. The API returns a JWS token and I want to able to store it somewhere too so that it can be used with subsequent requests