The Chilkat plugin is a phantastic plugin with relatively good examples. However, the examples are usually partial ones that need to be pieced together. I had really problems getting Oauth for Gmail to work. I thought that this would make a good example:
The whole documentation:
The code shows a full example on how to connect to Gmail. Enter a username without the "@gmail.com" and click on the connect button.
Before doing this you need to set up your own client id and client secret.
There is a bug in the current version of the Chilkat plugin with ListenPortRangeEnd. You need a newer version than from 29.06.2018 for this to work.
As usual the code uses MBS plugin. But here only CallDelegateOnMainThreadMBS is used to simplify the code.
The code is example code!!!
The code is tested on macOS 10.11 and 10.14.