I faced the same issue after taking a backup of the running Ec2 Instance and launching it again
The nonce relies on having the value set in redis and in session for csrf validation
I turned off the SiteSetting.discourse_connect_csrf_protection which made the login work consistently, but I haven’t debugged why the session is not being set properly yet