I am trying to implement facebook-login for my MVC+Angular site. When user click "Login by FB" I got the callback code, user email, name and etc. After that, I just want to LOGIN user:
HttpContext.GetOwinContext().Authentication.SignIn (new AuthenticationProperties { IsPersistent = true }, identity);
But even if I put this on the next line:
var userId = HttpContext.User.Identity.GetUserId();
userId always is null... What can I do?
UPD1: What I'm trying to say. For "simple" authorization I use this code (in Angular):
var config = {
method: 'POST',
url: '/getAuthToken',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
data: 'grant_type=password&username=' + email + '&password=' + password
};
$http(config)
.success(function(data) {
console.log('We`re now authenticated');
In my case, we don't have password, but already have token (thanks to external login). Should I call OWIN (/getAuthToken) with some other parameter (token instead password)?