{"action":"created","comment":{"url":"https://api.github.com/repos/xing/XNGAPIClient/pulls/comments/28694222","id":28694222,"diff_hunk":"@@ -440,6 +439,7 @@ - (void)checkForGlobalErrors:(NSHTTPURLResponse *)response\n     }\n     if ([JSON isKindOfClass:[NSDictionary class]] &&\n         [[JSON xng_stringForKey:@\"error_name\"] isEqualToString:@\"INVALID_OAUTH_TOKEN\"]) {\n+        [self logout];","path":"XNGAPIClient/XNGAPIClient.m","position":15,"original_position":15,"commit_id":"d7b6183df09ff35da8e3ffc9b6a729a2847c4f24","original_commit_id":"d7b6183df09ff35da8e3ffc9b6a729a2847c4f24","user":{"login":"stefanmunz","id":51411,"avatar_url":"https://avatars.githubusercontent.com/u/51411?v=3","gravatar_id":"","url":"https://api.github.com/users/stefanmunz","html_url":"https://github.com/stefanmunz","followers_url":"https://api.github.com/users/stefanmunz/followers","following_url":"https://api.github.com/users/stefanmunz/following{/other_user}","gists_url":"https://api.github.com/users/stefanmunz/gists{/gist_id}","starred_url":"https://api.github.com/users/stefanmunz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stefanmunz/subscriptions","organizations_url":"https://api.github.com/users/stefanmunz/orgs","repos_url":"https://api.github.com/users/stefanmunz/repos","events_url":"https://api.github.com/users/stefanmunz/events{/privacy}","received_events_url":"https://api.github.com/users/stefanmunz/received_events","type":"User","site_admin":false},"body":"hmm, this is a tough one. I am pretty sure adding a logout here is not a good idea. Directly in the next line a notification is triggered that executes this method at the moment: https://source.xing.com/ios/iphone-app/blob/master/Classes/XNGAppStartController.m#L652\r\nIn this method we unregister from pushes etc and then logout. Merging this would change this behaviour. Is it really needed or was it just a precaution here?","created_at":"2015-04-20T14:41:10Z","updated_at":"2015-04-20T14:41:10Z","html_url":"https://github.com/xing/XNGAPIClient/pull/52#discussion_r28694222","pull_request_url":"https://api.github.com/repos/xing/XNGAPIClient/pulls/52","_links":{"self":{"href":"https://api.github.com/repos/xing/XNGAPIClient/pulls/comments/28694222"},"html":{"href":"https://github.com/xing/XNGAPIClient/pull/52#discussion_r28694222"},"pull_request":{"href":"https://api.github.com/repos/xing/XNGAPIClient/pulls/52"}}},"pull_request":{"url":"https://api.github.com/repos/xing/XNGAPIClient/pulls/52","id":33667469,"html_url":"https://github.com/xing/XNGAPIClient/pull/52","diff_url":"https://github.com/xing/XNGAPIClient/pull/52.diff","patch_url":"https://github.com/xing/XNGAPIClient/pull/52.patch","issue_url":"https://api.github.com/repos/xing/XNGAPIClient/issues/52","number":52,"state":"open","locked":false,"title":"Clears the token and keychain if token is invalid or we start login","user":{"login":"tapwork","id":397342,"avatar_url":"https://avatars.githubusercontent.com/u/397342?v=3","gravatar_id":"","url":"https://api.github.com/users/tapwork","html_url":"https://github.com/tapwork","followers_url":"https://api.github.com/users/tapwork/followers","following_url":"https://api.github.com/users/tapwork/following{/other_user}","gists_url":"https://api.github.com/users/tapwork/gists{/gist_id}","starred_url":"https://api.github.com/users/tapwork/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tapwork/subscriptions","organizations_url":"https://api.github.com/users/tapwork/orgs","repos_url":"https://api.github.com/users/tapwork/repos","events_url":"https://api.github.com/users/tapwork/events{/privacy}","received_events_url":"https://api.github.com/users/tapwork/received_events","type":"User","site_admin":false},"body":"We faced the problem, that the token was invalid or not available on backend site. Our client considered us as logged in, because  we stored an access token. But the backend had no clue about this token.\r\nSo we need to clear the token and the keychain before we start a fresh login and also if the token is invalid.","created_at":"2015-04-20T13:56:59Z","updated_at":"2015-04-20T14:41:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"15afd6fad284ebd11e30977b488a7bcdffa86633","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/xing/XNGAPIClient/pulls/52/commits","review_comments_url":"https://api.github.com/repos/xing/XNGAPIClient/pulls/52/comments","review_comment_url":"https://api.github.com/repos/xing/XNGAPIClient/pulls/comments{/number}","comments_url":"https://api.github.com/repos/xing/XNGAPIClient/issues/52/comments","statuses_url":"https://api.github.com/repos/xing/XNGAPIClient/statuses/d7b6183df09ff35da8e3ffc9b6a729a2847c4f24","head":{"label":"xing:logout_before_new_login_and_when_token_invalid","ref":"logout_before_new_login_and_when_token_invalid","sha":"d7b6183df09ff35da8e3ffc9b6a729a2847c4f24","user":{"login":"xing","id":27901,"avatar_url":"https://avatars.githubusercontent.com/u/27901?v=3","gravatar_id":"","url":"https://api.github.com/users/xing","html_url":"https://github.com/xing","followers_url":"https://api.github.com/users/xing/followers","following_url":"https://api.github.com/users/xing/following{/other_user}","gists_url":"https://api.github.com/users/xing/gists{/gist_id}","starred_url":"https://api.github.com/users/xing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xing/subscriptions","organizations_url":"https://api.github.com/users/xing/orgs","repos_url":"https://api.github.com/users/xing/repos","events_url":"https://api.github.com/users/xing/events{/privacy}","received_events_url":"https://api.github.com/users/xing/received_events","type":"Organization","site_admin":false},"repo":{"id":12001416,"name":"XNGAPIClient","full_name":"xing/XNGAPIClient","owner":{"login":"xing","id":27901,"avatar_url":"https://avatars.githubusercontent.com/u/27901?v=3","gravatar_id":"","url":"https://api.github.com/users/xing","html_url":"https://github.com/xing","followers_url":"https://api.github.com/users/xing/followers","following_url":"https://api.github.com/users/xing/following{/other_user}","gists_url":"https://api.github.com/users/xing/gists{/gist_id}","starred_url":"https://api.github.com/users/xing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xing/subscriptions","organizations_url":"https://api.github.com/users/xing/orgs","repos_url":"https://api.github.com/users/xing/repos","events_url":"https://api.github.com/users/xing/events{/privacy}","received_events_url":"https://api.github.com/users/xing/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/xing/XNGAPIClient","description":"The official XING API client for Objective-C","fork":false,"url":"https://api.github.com/repos/xing/XNGAPIClient","forks_url":"https://api.github.com/repos/xing/XNGAPIClient/forks","keys_url":"https://api.github.com/repos/xing/XNGAPIClient/keys{/key_id}","collaborators_url":"https://api.github.com/repos/xing/XNGAPIClient/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/xing/XNGAPIClient/teams","hooks_url":"https://api.github.com/repos/xing/XNGAPIClient/hooks","issue_events_url":"https://api.github.com/repos/xing/XNGAPIClient/issues/events{/number}","events_url":"https://api.github.com/repos/xing/XNGAPIClient/events","assignees_url":"https://api.github.com/repos/xing/XNGAPIClient/assignees{/user}","branches_url":"https://api.github.com/repos/xing/XNGAPIClient/branches{/branch}","tags_url":"https://api.github.com/repos/xing/XNGAPIClient/tags","blobs_url":"https://api.github.com/repos/xing/XNGAPIClient/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/xing/XNGAPIClient/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/xing/XNGAPIClient/git/refs{/sha}","trees_url":"https://api.github.com/repos/xing/XNGAPIClient/git/trees{/sha}","statuses_url":"https://api.github.com/repos/xing/XNGAPIClient/statuses/{sha}","languages_url":"https://api.github.com/repos/xing/XNGAPIClient/languages","stargazers_url":"https://api.github.com/repos/xing/XNGAPIClient/stargazers","contributors_url":"https://api.github.com/repos/xing/XNGAPIClient/contributors","subscribers_url":"https://api.github.com/repos/xing/XNGAPIClient/subscribers","subscription_url":"https://api.github.com/repos/xing/XNGAPIClient/subscription","commits_url":"https://api.github.com/repos/xing/XNGAPIClient/commits{/sha}","git_commits_url":"https://api.github.com/repos/xing/XNGAPIClient/git/commits{/sha}","comments_url":"https://api.github.com/repos/xing/XNGAPIClient/comments{/number}","issue_comment_url":"https://api.github.com/repos/xing/XNGAPIClient/issues/comments{/number}","contents_url":"https://api.github.com/repos/xing/XNGAPIClient/contents/{+path}","compare_url":"https://api.github.com/repos/xing/XNGAPIClient/compare/{base}...{head}","merges_url":"https://api.github.com/repos/xing/XNGAPIClient/merges","archive_url":"https://api.github.com/repos/xing/XNGAPIClient/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/xing/XNGAPIClient/downloads","issues_url":"https://api.github.com/repos/xing/XNGAPIClient/issues{/number}","pulls_url":"https://api.github.com/repos/xing/XNGAPIClient/pulls{/number}","milestones_url":"https://api.github.com/repos/xing/XNGAPIClient/milestones{/number}","notifications_url":"https://api.github.com/repos/xing/XNGAPIClient/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/xing/XNGAPIClient/labels{/name}","releases_url":"https://api.github.com/repos/xing/XNGAPIClient/releases{/id}","created_at":"2013-08-09T13:25:13Z","updated_at":"2015-03-13T09:29:53Z","pushed_at":"2015-04-20T13:56:59Z","git_url":"git://github.com/xing/XNGAPIClient.git","ssh_url":"git@github.com:xing/XNGAPIClient.git","clone_url":"https://github.com/xing/XNGAPIClient.git","svn_url":"https://github.com/xing/XNGAPIClient","homepage":null,"size":1384,"stargazers_count":33,"watchers_count":33,"language":"Objective-C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":18,"mirror_url":null,"open_issues_count":2,"forks":18,"open_issues":2,"watchers":33,"default_branch":"master"}},"base":{"label":"xing:master","ref":"master","sha":"4421b1b6ee0373b43e98a6c59404d5e0c2299216","user":{"login":"xing","id":27901,"avatar_url":"https://avatars.githubusercontent.com/u/27901?v=3","gravatar_id":"","url":"https://api.github.com/users/xing","html_url":"https://github.com/xing","followers_url":"https://api.github.com/users/xing/followers","following_url":"https://api.github.com/users/xing/following{/other_user}","gists_url":"https://api.github.com/users/xing/gists{/gist_id}","starred_url":"https://api.github.com/users/xing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xing/subscriptions","organizations_url":"https://api.github.com/users/xing/orgs","repos_url":"https://api.github.com/users/xing/repos","events_url":"https://api.github.com/users/xing/events{/privacy}","received_events_url":"https://api.github.com/users/xing/received_events","type":"Organization","site_admin":false},"repo":{"id":12001416,"name":"XNGAPIClient","full_name":"xing/XNGAPIClient","owner":{"login":"xing","id":27901,"avatar_url":"https://avatars.githubusercontent.com/u/27901?v=3","gravatar_id":"","url":"https://api.github.com/users/xing","html_url":"https://github.com/xing","followers_url":"https://api.github.com/users/xing/followers","following_url":"https://api.github.com/users/xing/following{/other_user}","gists_url":"https://api.github.com/users/xing/gists{/gist_id}","starred_url":"https://api.github.com/users/xing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xing/subscriptions","organizations_url":"https://api.github.com/users/xing/orgs","repos_url":"https://api.github.com/users/xing/repos","events_url":"https://api.github.com/users/xing/events{/privacy}","received_events_url":"https://api.github.com/users/xing/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/xing/XNGAPIClient","description":"The official XING API client for Objective-C","fork":false,"url":"https://api.github.com/repos/xing/XNGAPIClient","forks_url":"https://api.github.com/repos/xing/XNGAPIClient/forks","keys_url":"https://api.github.com/repos/xing/XNGAPIClient/keys{/key_id}","collaborators_url":"https://api.github.com/repos/xing/XNGAPIClient/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/xing/XNGAPIClient/teams","hooks_url":"https://api.github.com/repos/xing/XNGAPIClient/hooks","issue_events_url":"https://api.github.com/repos/xing/XNGAPIClient/issues/events{/number}","events_url":"https://api.github.com/repos/xing/XNGAPIClient/events","assignees_url":"https://api.github.com/repos/xing/XNGAPIClient/assignees{/user}","branches_url":"https://api.github.com/repos/xing/XNGAPIClient/branches{/branch}","tags_url":"https://api.github.com/repos/xing/XNGAPIClient/tags","blobs_url":"https://api.github.com/repos/xing/XNGAPIClient/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/xing/XNGAPIClient/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/xing/XNGAPIClient/git/refs{/sha}","trees_url":"https://api.github.com/repos/xing/XNGAPIClient/git/trees{/sha}","statuses_url":"https://api.github.com/repos/xing/XNGAPIClient/statuses/{sha}","languages_url":"https://api.github.com/repos/xing/XNGAPIClient/languages","stargazers_url":"https://api.github.com/repos/xing/XNGAPIClient/stargazers","contributors_url":"https://api.github.com/repos/xing/XNGAPIClient/contributors","subscribers_url":"https://api.github.com/repos/xing/XNGAPIClient/subscribers","subscription_url":"https://api.github.com/repos/xing/XNGAPIClient/subscription","commits_url":"https://api.github.com/repos/xing/XNGAPIClient/commits{/sha}","git_commits_url":"https://api.github.com/repos/xing/XNGAPIClient/git/commits{/sha}","comments_url":"https://api.github.com/repos/xing/XNGAPIClient/comments{/number}","issue_comment_url":"https://api.github.com/repos/xing/XNGAPIClient/issues/comments{/number}","contents_url":"https://api.github.com/repos/xing/XNGAPIClient/contents/{+path}","compare_url":"https://api.github.com/repos/xing/XNGAPIClient/compare/{base}...{head}","merges_url":"https://api.github.com/repos/xing/XNGAPIClient/merges","archive_url":"https://api.github.com/repos/xing/XNGAPIClient/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/xing/XNGAPIClient/downloads","issues_url":"https://api.github.com/repos/xing/XNGAPIClient/issues{/number}","pulls_url":"https://api.github.com/repos/xing/XNGAPIClient/pulls{/number}","milestones_url":"https://api.github.com/repos/xing/XNGAPIClient/milestones{/number}","notifications_url":"https://api.github.com/repos/xing/XNGAPIClient/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/xing/XNGAPIClient/labels{/name}","releases_url":"https://api.github.com/repos/xing/XNGAPIClient/releases{/id}","created_at":"2013-08-09T13:25:13Z","updated_at":"2015-03-13T09:29:53Z","pushed_at":"2015-04-20T13:56:59Z","git_url":"git://github.com/xing/XNGAPIClient.git","ssh_url":"git@github.com:xing/XNGAPIClient.git","clone_url":"https://github.com/xing/XNGAPIClient.git","svn_url":"https://github.com/xing/XNGAPIClient","homepage":null,"size":1384,"stargazers_count":33,"watchers_count":33,"language":"Objective-C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":18,"mirror_url":null,"open_issues_count":2,"forks":18,"open_issues":2,"watchers":33,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/xing/XNGAPIClient/pulls/52"},"html":{"href":"https://github.com/xing/XNGAPIClient/pull/52"},"issue":{"href":"https://api.github.com/repos/xing/XNGAPIClient/issues/52"},"comments":{"href":"https://api.github.com/repos/xing/XNGAPIClient/issues/52/comments"},"review_comments":{"href":"https://api.github.com/repos/xing/XNGAPIClient/pulls/52/comments"},"review_comment":{"href":"https://api.github.com/repos/xing/XNGAPIClient/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/xing/XNGAPIClient/pulls/52/commits"},"statuses":{"href":"https://api.github.com/repos/xing/XNGAPIClient/statuses/d7b6183df09ff35da8e3ffc9b6a729a2847c4f24"}}}}