I factory reset my phone yesterday because I lost my password. When I got to the step that asks me to log into my Samsung account, I filled in my details and it kept on saying "Sign in cancelled" and wouldn't let me log in. So I skipped it. Now it keeps on giving me the error and I've had to make a new account just to post this as it still won't let me get into my old one.
If you have access to your email account related to your samsung account, then you will need to reset your password for the samsung account first. Then set up 2 step verification and samsung will sign you out on all connected devices. Then just sign back in my friend. If you have any problems with it, you will need to email samsung and verify some details while they review your account. They will then send you a link to log in. 👍