{"action":"created","comment":{"url":"https://api.github.com/repos/vokal/Soundie-iOS/pulls/comments/23330062","id":23330062,"diff_hunk":"@@ -0,0 +1,66 @@\n+//\n+//  AuthorizationUtility.swift\n+//  Soundie\n+//\n+//  Created by Erik  Krag on 12/2/14.\n+//  Copyright (c) 2014 Vokal. All rights reserved.\n+//\n+\n+import Foundation\n+\n+class AuthorizationUtility : NetworkingBaseClass {\n+    \n+    //MARK: URL's\n+    private let authorizationURLString = \"https://soundcloud.com/connect\"\n+    private let tokenUrlString = NetworkingBaseClass.apiStringForPath(\"oauth2/token\")\n+    \n+    var isUserLoggedIn: Bool {\n+        get{\n+            if self.accessToken != nil {\n+                return true\n+            } else {\n+                return false\n+            }\n+        }\n+    }\n+    \n+    func authorizeSoundCloud(completionClosure:(success: Bool, error: NSError?)->()) -> (GTMOAuth2ViewControllerTouch?)\n+    {\n+        func soundCloudAuth() -> GTMOAuth2Authentication\n+        {\n+            let tokenURL = NSURL(string: tokenUrlString)\n+            \n+            var auth = GTMOAuth2Authentication.authenticationWithServiceProvider(serviceName,\n+                                                                                 tokenURL: tokenURL,\n+                                                                                 redirectURI: SoundCloudRedirectUri,\n+                                                                                 clientID: SoundCloudClientID,\n+                                                                                 clientSecret: SoundCloudClientSecret) as GTMOAuth2Authentication\n+            \n+            return auth\n+        }\n+        \n+        let authUrl = NSURL(string: authorizationURLString)\n+        \n+        var authViewController = GTMOAuth2ViewControllerTouch.controllerWithAuthentication(soundCloudAuth(),\n+                                                                                           authorizationURL: authUrl,\n+                                                                                           keychainItemName: nil) { [unowned self]\n+                                                                                            (viewController: GTMOAuth2ViewControllerTouch!, auth: GTMOAuth2Authentication!,err: NSError!) -> Void in\n+            if auth.accessToken != nil {\n+                self.saveAccessToken(auth.accessToken)\n+                completionClosure(success: true, error: nil)\n+            } else {\n+                println(err)\n+                completionClosure(success: false, error: err)\n+            }\n+        } as GTMOAuth2ViewControllerTouch\n+\n+        //TODO:might need to figure out why this can't be assigned\n+//        authViewController.browserCookiesURL = NSURL(string: apiBaseUrlString)","path":"Soundie/Soundie/Controls/AuthorizationUtility.swift","position":58,"original_position":58,"commit_id":"c66589d7fc04e55a260e17444e83f00740d3f377","original_commit_id":"c66589d7fc04e55a260e17444e83f00740d3f377","user":{"login":"eckrag89","id":3965796,"avatar_url":"https://avatars.githubusercontent.com/u/3965796?v=3","gravatar_id":"","url":"https://api.github.com/users/eckrag89","html_url":"https://github.com/eckrag89","followers_url":"https://api.github.com/users/eckrag89/followers","following_url":"https://api.github.com/users/eckrag89/following{/other_user}","gists_url":"https://api.github.com/users/eckrag89/gists{/gist_id}","starred_url":"https://api.github.com/users/eckrag89/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eckrag89/subscriptions","organizations_url":"https://api.github.com/users/eckrag89/orgs","repos_url":"https://api.github.com/users/eckrag89/repos","events_url":"https://api.github.com/users/eckrag89/events{/privacy}","received_events_url":"https://api.github.com/users/eckrag89/received_events","type":"User","site_admin":false},"body":"not sure what I was doing when I first wrote this but it is fixed now.","created_at":"2015-01-21T20:09:18Z","updated_at":"2015-01-21T20:09:18Z","html_url":"https://github.com/vokal/Soundie-iOS/pull/5#discussion_r23330062","pull_request_url":"https://api.github.com/repos/vokal/Soundie-iOS/pulls/5","_links":{"self":{"href":"https://api.github.com/repos/vokal/Soundie-iOS/pulls/comments/23330062"},"html":{"href":"https://github.com/vokal/Soundie-iOS/pull/5#discussion_r23330062"},"pull_request":{"href":"https://api.github.com/repos/vokal/Soundie-iOS/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/vokal/Soundie-iOS/pulls/5","id":27784462,"html_url":"https://github.com/vokal/Soundie-iOS/pull/5","diff_url":"https://github.com/vokal/Soundie-iOS/pull/5.diff","patch_url":"https://github.com/vokal/Soundie-iOS/pull/5.patch","issue_url":"https://api.github.com/repos/vokal/Soundie-iOS/issues/5","number":5,"state":"open","locked":false,"title":"Added Login view and Travis support","user":{"login":"eckrag89","id":3965796,"avatar_url":"https://avatars.githubusercontent.com/u/3965796?v=3","gravatar_id":"","url":"https://api.github.com/users/eckrag89","html_url":"https://github.com/eckrag89","followers_url":"https://api.github.com/users/eckrag89/followers","following_url":"https://api.github.com/users/eckrag89/following{/other_user}","gists_url":"https://api.github.com/users/eckrag89/gists{/gist_id}","starred_url":"https://api.github.com/users/eckrag89/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eckrag89/subscriptions","organizations_url":"https://api.github.com/users/eckrag89/orgs","repos_url":"https://api.github.com/users/eckrag89/repos","events_url":"https://api.github.com/users/eckrag89/events{/privacy}","received_events_url":"https://api.github.com/users/eckrag89/received_events","type":"User","site_admin":false},"body":"This adds simple login view as well as an attempt to Obfuscate the secret and keys for Soundcloud so they will be added before build-time by travis and otherwise have to be added manually.  Updated readme will come in the next pull request.","created_at":"2015-01-21T18:51:17Z","updated_at":"2015-01-21T20:09:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"173abe3f3b3e03fbaaa56c0077636c6f1b874454","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/vokal/Soundie-iOS/pulls/5/commits","review_comments_url":"https://api.github.com/repos/vokal/Soundie-iOS/pulls/5/comments","review_comment_url":"https://api.github.com/repos/vokal/Soundie-iOS/pulls/comments/{number}","comments_url":"https://api.github.com/repos/vokal/Soundie-iOS/issues/5/comments","statuses_url":"https://api.github.com/repos/vokal/Soundie-iOS/statuses/c66589d7fc04e55a260e17444e83f00740d3f377","head":{"label":"eckrag89:loginView","ref":"loginView","sha":"c66589d7fc04e55a260e17444e83f00740d3f377","user":{"login":"eckrag89","id":3965796,"avatar_url":"https://avatars.githubusercontent.com/u/3965796?v=3","gravatar_id":"","url":"https://api.github.com/users/eckrag89","html_url":"https://github.com/eckrag89","followers_url":"https://api.github.com/users/eckrag89/followers","following_url":"https://api.github.com/users/eckrag89/following{/other_user}","gists_url":"https://api.github.com/users/eckrag89/gists{/gist_id}","starred_url":"https://api.github.com/users/eckrag89/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eckrag89/subscriptions","organizations_url":"https://api.github.com/users/eckrag89/orgs","repos_url":"https://api.github.com/users/eckrag89/repos","events_url":"https://api.github.com/users/eckrag89/events{/privacy}","received_events_url":"https://api.github.com/users/eckrag89/received_events","type":"User","site_admin":false},"repo":{"id":27142703,"name":"Soundie-iOS","full_name":"eckrag89/Soundie-iOS","owner":{"login":"eckrag89","id":3965796,"avatar_url":"https://avatars.githubusercontent.com/u/3965796?v=3","gravatar_id":"","url":"https://api.github.com/users/eckrag89","html_url":"https://github.com/eckrag89","followers_url":"https://api.github.com/users/eckrag89/followers","following_url":"https://api.github.com/users/eckrag89/following{/other_user}","gists_url":"https://api.github.com/users/eckrag89/gists{/gist_id}","starred_url":"https://api.github.com/users/eckrag89/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eckrag89/subscriptions","organizations_url":"https://api.github.com/users/eckrag89/orgs","repos_url":"https://api.github.com/users/eckrag89/repos","events_url":"https://api.github.com/users/eckrag89/events{/privacy}","received_events_url":"https://api.github.com/users/eckrag89/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/eckrag89/Soundie-iOS","description":"SoundCloud app.","fork":true,"url":"https://api.github.com/repos/eckrag89/Soundie-iOS","forks_url":"https://api.github.com/repos/eckrag89/Soundie-iOS/forks","keys_url":"https://api.github.com/repos/eckrag89/Soundie-iOS/keys{/key_id}","collaborators_url":"https://api.github.com/repos/eckrag89/Soundie-iOS/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/eckrag89/Soundie-iOS/teams","hooks_url":"https://api.github.com/repos/eckrag89/Soundie-iOS/hooks","issue_events_url":"https://api.github.com/repos/eckrag89/Soundie-iOS/issues/events{/number}","events_url":"https://api.github.com/repos/eckrag89/Soundie-iOS/events","assignees_url":"https://api.github.com/repos/eckrag89/Soundie-iOS/assignees{/user}","branches_url":"https://api.github.com/repos/eckrag89/Soundie-iOS/branches{/branch}","tags_url":"https://api.github.com/repos/eckrag89/Soundie-iOS/tags","blobs_url":"https://api.github.com/repos/eckrag89/Soundie-iOS/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/eckrag89/Soundie-iOS/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/eckrag89/Soundie-iOS/git/refs{/sha}","trees_url":"https://api.github.com/repos/eckrag89/Soundie-iOS/git/trees{/sha}","statuses_url":"https://api.github.com/repos/eckrag89/Soundie-iOS/statuses/{sha}","languages_url":"https://api.github.com/repos/eckrag89/Soundie-iOS/languages","stargazers_url":"https://api.github.com/repos/eckrag89/Soundie-iOS/stargazers","contributors_url":"https://api.github.com/repos/eckrag89/Soundie-iOS/contributors","subscribers_url":"https://api.github.com/repos/eckrag89/Soundie-iOS/subscribers","subscription_url":"https://api.github.com/repos/eckrag89/Soundie-iOS/subscription","commits_url":"https://api.github.com/repos/eckrag89/Soundie-iOS/commits{/sha}","git_commits_url":"https://api.github.com/repos/eckrag89/Soundie-iOS/git/commits{/sha}","comments_url":"https://api.github.com/repos/eckrag89/Soundie-iOS/comments{/number}","issue_comment_url":"https://api.github.com/repos/eckrag89/Soundie-iOS/issues/comments/{number}","contents_url":"https://api.github.com/repos/eckrag89/Soundie-iOS/contents/{+path}","compare_url":"https://api.github.com/repos/eckrag89/Soundie-iOS/compare/{base}...{head}","merges_url":"https://api.github.com/repos/eckrag89/Soundie-iOS/merges","archive_url":"https://api.github.com/repos/eckrag89/Soundie-iOS/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/eckrag89/Soundie-iOS/downloads","issues_url":"https://api.github.com/repos/eckrag89/Soundie-iOS/issues{/number}","pulls_url":"https://api.github.com/repos/eckrag89/Soundie-iOS/pulls{/number}","milestones_url":"https://api.github.com/repos/eckrag89/Soundie-iOS/milestones{/number}","notifications_url":"https://api.github.com/repos/eckrag89/Soundie-iOS/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/eckrag89/Soundie-iOS/labels{/name}","releases_url":"https://api.github.com/repos/eckrag89/Soundie-iOS/releases{/id}","created_at":"2014-11-25T19:39:25Z","updated_at":"2015-01-20T04:37:10Z","pushed_at":"2015-01-21T18:46:44Z","git_url":"git://github.com/eckrag89/Soundie-iOS.git","ssh_url":"git@github.com:eckrag89/Soundie-iOS.git","clone_url":"https://github.com/eckrag89/Soundie-iOS.git","svn_url":"https://github.com/eckrag89/Soundie-iOS","homepage":null,"size":433,"stargazers_count":0,"watchers_count":0,"language":"Objective-C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"vokal:master","ref":"master","sha":"efb55ef575becab4d65901f3e30f24399c94db43","user":{"login":"vokal","id":375026,"avatar_url":"https://avatars.githubusercontent.com/u/375026?v=3","gravatar_id":"","url":"https://api.github.com/users/vokal","html_url":"https://github.com/vokal","followers_url":"https://api.github.com/users/vokal/followers","following_url":"https://api.github.com/users/vokal/following{/other_user}","gists_url":"https://api.github.com/users/vokal/gists{/gist_id}","starred_url":"https://api.github.com/users/vokal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vokal/subscriptions","organizations_url":"https://api.github.com/users/vokal/orgs","repos_url":"https://api.github.com/users/vokal/repos","events_url":"https://api.github.com/users/vokal/events{/privacy}","received_events_url":"https://api.github.com/users/vokal/received_events","type":"Organization","site_admin":false},"repo":{"id":27142101,"name":"Soundie-iOS","full_name":"vokal/Soundie-iOS","owner":{"login":"vokal","id":375026,"avatar_url":"https://avatars.githubusercontent.com/u/375026?v=3","gravatar_id":"","url":"https://api.github.com/users/vokal","html_url":"https://github.com/vokal","followers_url":"https://api.github.com/users/vokal/followers","following_url":"https://api.github.com/users/vokal/following{/other_user}","gists_url":"https://api.github.com/users/vokal/gists{/gist_id}","starred_url":"https://api.github.com/users/vokal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vokal/subscriptions","organizations_url":"https://api.github.com/users/vokal/orgs","repos_url":"https://api.github.com/users/vokal/repos","events_url":"https://api.github.com/users/vokal/events{/privacy}","received_events_url":"https://api.github.com/users/vokal/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/vokal/Soundie-iOS","description":"SoundCloud app.","fork":false,"url":"https://api.github.com/repos/vokal/Soundie-iOS","forks_url":"https://api.github.com/repos/vokal/Soundie-iOS/forks","keys_url":"https://api.github.com/repos/vokal/Soundie-iOS/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vokal/Soundie-iOS/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vokal/Soundie-iOS/teams","hooks_url":"https://api.github.com/repos/vokal/Soundie-iOS/hooks","issue_events_url":"https://api.github.com/repos/vokal/Soundie-iOS/issues/events{/number}","events_url":"https://api.github.com/repos/vokal/Soundie-iOS/events","assignees_url":"https://api.github.com/repos/vokal/Soundie-iOS/assignees{/user}","branches_url":"https://api.github.com/repos/vokal/Soundie-iOS/branches{/branch}","tags_url":"https://api.github.com/repos/vokal/Soundie-iOS/tags","blobs_url":"https://api.github.com/repos/vokal/Soundie-iOS/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vokal/Soundie-iOS/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vokal/Soundie-iOS/git/refs{/sha}","trees_url":"https://api.github.com/repos/vokal/Soundie-iOS/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vokal/Soundie-iOS/statuses/{sha}","languages_url":"https://api.github.com/repos/vokal/Soundie-iOS/languages","stargazers_url":"https://api.github.com/repos/vokal/Soundie-iOS/stargazers","contributors_url":"https://api.github.com/repos/vokal/Soundie-iOS/contributors","subscribers_url":"https://api.github.com/repos/vokal/Soundie-iOS/subscribers","subscription_url":"https://api.github.com/repos/vokal/Soundie-iOS/subscription","commits_url":"https://api.github.com/repos/vokal/Soundie-iOS/commits{/sha}","git_commits_url":"https://api.github.com/repos/vokal/Soundie-iOS/git/commits{/sha}","comments_url":"https://api.github.com/repos/vokal/Soundie-iOS/comments{/number}","issue_comment_url":"https://api.github.com/repos/vokal/Soundie-iOS/issues/comments/{number}","contents_url":"https://api.github.com/repos/vokal/Soundie-iOS/contents/{+path}","compare_url":"https://api.github.com/repos/vokal/Soundie-iOS/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vokal/Soundie-iOS/merges","archive_url":"https://api.github.com/repos/vokal/Soundie-iOS/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vokal/Soundie-iOS/downloads","issues_url":"https://api.github.com/repos/vokal/Soundie-iOS/issues{/number}","pulls_url":"https://api.github.com/repos/vokal/Soundie-iOS/pulls{/number}","milestones_url":"https://api.github.com/repos/vokal/Soundie-iOS/milestones{/number}","notifications_url":"https://api.github.com/repos/vokal/Soundie-iOS/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vokal/Soundie-iOS/labels{/name}","releases_url":"https://api.github.com/repos/vokal/Soundie-iOS/releases{/id}","created_at":"2014-11-25T19:23:52Z","updated_at":"2015-01-14T13:02:06Z","pushed_at":"2015-01-14T13:02:04Z","git_url":"git://github.com/vokal/Soundie-iOS.git","ssh_url":"git@github.com:vokal/Soundie-iOS.git","clone_url":"https://github.com/vokal/Soundie-iOS.git","svn_url":"https://github.com/vokal/Soundie-iOS","homepage":null,"size":444,"stargazers_count":1,"watchers_count":1,"language":"Objective-C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/vokal/Soundie-iOS/pulls/5"},"html":{"href":"https://github.com/vokal/Soundie-iOS/pull/5"},"issue":{"href":"https://api.github.com/repos/vokal/Soundie-iOS/issues/5"},"comments":{"href":"https://api.github.com/repos/vokal/Soundie-iOS/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/vokal/Soundie-iOS/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/vokal/Soundie-iOS/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/vokal/Soundie-iOS/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/vokal/Soundie-iOS/statuses/c66589d7fc04e55a260e17444e83f00740d3f377"}}}}