Since your iPhone and iPads can sign in to Apple services normally, the problem appears to be isolated to your iMac rather than your Apple Account.
Because several Apple services are affected simultaneously, possible causes include a network connectivity issue, incorrect date and time settings, or a problem with the macOS account authentication services.
I suggest trying the following troubleshooting steps from your Mac:
- Check Date & Time: Open System Preferences > Date & Time and verify that the date, time, and time zone are correct. If possible, enable automatic date and time.
- Check Apple service connectivity: Open Safari and visit https://account.apple.com to see whether you can sign in successfully using your Apple Account.
- Try Safe Mode: Restart your iMac while holding the Shift key until the Apple logo appears. Once in Safe Mode, try signing in to one of the affected Apple services.
- Test another macOS user account: If the problem persists, create a temporary administrator account in System Preferences > Users & Groups. Sign in to that account and check whether the App Store works.
If Apple services work in another macOS user account, the problem is likely associated with your original user profile. If they fail in both accounts, the issue may involve macOS itself or network connectivity.