User authentication from scratch