iPhone asked for password of an unknown device
My iPhone wanted me to log into my Apple ID, and asked the password for an unknown device (name was something like "Mac-[random code of 12 numbers and lower case letters]"). I restarted both my MacBook and my iPhone (only active Apple devices I have), changed my Apple ID password, logged off on all devices, found the devices connected to my Apple ID (all are devices I know), scanned for malware (used Malwarebytes; no malware detected), to no avail. My iPhone doesn't let me log into iCloud without the password for this device.
The exact message says:
Enter Mac Password
Enter the password you use to unlock the Mac "Mac-************".
This passwords protects your Apple ID, saved passwords and other data stored in iCloud. Your password is encrypted and cannot be read by Apple.
If I tap Don't know Device Password, it says:
Don't know Password?
If you can't remember the password for "Mac-************", you can approve this iPhone from one of your other devices signed into iCloud, or you can reset your end-to-end encrypted data.
I have already approved this iPhone from my MacBook, but this problem still keeps coming up. Below the message are buttons for Reset Encrypted Data and Cancel. Cancel brings me back to the previous message. When I tap Reset Encrypted Data, yet another message pops up that says that all my data in iCloud will be deleted permanently if I continue.
Can someone please explain what is going on and what I can do to solve this?
Thank you!
iPhone SE, iOS 15