How to remember strategy that user was logged in?

I have several strategies to authenticate to my app (twitter, google, ect.) I need to remember the strategy that user was logged in. Where is the best place to store it?

{
    "_id": {
        "$oid": "54d67c318ba5c79205c9ca00"
    },
    "facebook": {
        "id": "344435342",
        "token": "xxx",
        "name": "Erik",
        "email": "erik@google.com"
    },
    "twitter": {
        "id": "253452",
        "token": "xxx",
        "name": "Erik",
        "username": "ekir"
    },
}

The User Profile (req.user) contains a property

provider {String}

The provider with which the user authenticated (facebook, twitter, etc.).


As per our discussion in the chat room it seems you actually needed the access to profile which is available inside function(accessToken, refreshToken, profile, done) { of the passport authenticate function. You could then persist the profile.provider along with the user data model, or store it a session through the use of a passport custom callback.