When a Subscribed Anonymous User signs-in all the purchases and history are transferred to the new provided signed-in User information.
You need to check the value of the variable "refresh" in the callback of the userLogin() method. If refresh is true, then purchases have been transferred to the user and you have to update and refresh the User information to provide his entitlements.
If prior to the authentication, the provided user already had subscriptions he will gather the new ones, even if this causes duplicates.
If the user disconnects, the device will be anonymous again and the anonymous user won't have any active subscriptions as they were transferred.
The user can get them back by making a restore of its transactions.