Fix setting authentication credentials in the session.