Login with SSO option does not exchange SSL certificates

Yes. You need to use the same hostname consistently. Discourse won’t be adding the “www”, that’s something else, possibly leftover from some www.example.com type placeholder.