How to authenticate a user using cached credentials?