Is Flarum the client or the server of the single sign-on ? From the docs I guess you're planning to use Flarum as the single sign-on server ?
For Flarum as server I guess you just need to call the methods of their PHP SDK via an extension. Check out the various events available in Flarum, one is probably right for that task.
If however you want to enable users to log into Flarum with their Chatwee account you will probably need to write the oauth client code for it based on https://github.com/thephpleague/oauth2-client before integrating it in a Flarum Auth extension (check the other auth extensions !)