You must manually perform the conversion manually, because the claims are internal strings. We could provide some kind of general extension, for example User.Identity.GetUserId, which is trying to convert from a string → T, and this is what we are looking at in future versions.
source share