If you click "Log in with Twitter" as a guest, or "Associate with Twitter" when logged in, and you decide not to go ahead with the authorisation, and you click "Cancel", and then "Return to [site]", it will redirect you to an error message: "An unexpected error occurred. Please try again later".
Could it not safely take the user back to the originating page using the oauth_callback URL?
Maybe it can be changed "We were unable to link your twitter account, Please continue with registration via normal form from here." So they don't leave the site without registration and at the same they get to know what went wrong.
They are already returned back to the oauth callback URL. That URL is index.php?register/twitter and that's the page that all requests must be returned to so we can then see the response and work with it accordingly.
Really, we can't do anything else here other than return a different error message, so for the next release we have changed the message to:
"Unfortunately, you did not grant permission to access your external account. This is required to continue."
This applies to Facebook, Twitter and Google registrations too.
We can't specifically ask them to continue with registration as normal as it may be an existing user associating their external account.
I noticed that if we click on "Cancel" for facebook external account link page, XenForo returns a different error message than it does with Twitter and whereas for Google Integration, there is no error message from unless Google oauth settings are wrong.
The messages in all cases are consistent now. The exception is Google where that is handled differently but there was one point in the code where it can return a generic error, which has been changed to match the other errors.