const SFAuthenticationSession = require('SafariServices/SFAuthenticationSession'); const NSURL = require('Foundation/NSURL'); const session = SFAuthenticationSession.alloc().initWithURLCallbackURLSchemeCompletionHandler( NSURL.alloc().initWithString('https://github.com/login/oauth/authorize?scope=repo&client_id=XXXXX'), 'appcgithub://', function(url, error) { if (error != null) { Ti.API.error('Error performing OAuth: ' + error.localizedDescription); cb({ success: false, error: 'Error performing OAuth: ' + error.localizedDescription }); return; } cb({ success: true, url: url.absoluteString }); }); function cb(e) { Ti.API.info(e); }