I prefer a service over library because it is easier to constantly upgrade a service behind the scenes without having to update your own application dependancies.
To a large extent it depends on your environment. For example, for an AWS based app, I would Cognito.