Desired URL lost if `login required` is enabled and social logins are used

This works properly with SSO for login-required forums. The original link is passed as session[:destination_url] to /session/sso and then saved. It also works if you create an external SSO link with a return_path parameter:

http://forum/example.com/session/sso?return_path=http://forum.example.com/t/test-topic/123