Oauth2 template for ios, but basically should work on Mac with tweaking. Includes Twitter example