{"action":"created","comment":{"url":"https://api.github.com/repos/ably/ably-ios/pulls/comments/77158852","id":77158852,"diff_hunk":"@@ -1885,5 +1894,104 @@ class Auth : QuickSpec {\n                 }\n             }\n         }\n+        \n+        describe(\"Reauth\") {\n+            it(\"should use authorise({force: true}) to reauth with a token with a different set of capabilities\") {\n+                // init ARTRest\n+                let restOptions = AblyTests.setupOptions(AblyTests.jsonRestOptions)\n+                let rest = ARTRest(options: restOptions)\n+                \n+                // get first token\n+                let tokenParams = ARTTokenParams()\n+                tokenParams.capability = \"{\\\"wrongchannel\\\": [\\\"*\\\"]}\"\n+                tokenParams.clientId = \"testClientId\"\n+                \n+                var firstToken = \"\"\n+                \n+                waitUntil(timeout: testTimeout) { done in\n+                    rest.auth.requestToken(tokenParams, withOptions: nil) { tokenDetails, error in\n+                        expect(error).to(beNil())\n+                        expect(tokenDetails).toNot(beNil())\n+                        firstToken = tokenDetails!.token\n+                        done()\n+                    }\n+                }\n+                expect(firstToken).toNot(beNil())\n+                expect(firstToken.characters.count > 0).to(beTrue())\n+                \n+                // init ARTRealtime\n+                let realtimeOptions = AblyTests.commonAppSetup()\n+                realtimeOptions.token = firstToken\n+                realtimeOptions.clientId = \"testClientId\"\n+                \n+                let realtime = ARTRealtime(options:realtimeOptions)\n+                defer { realtime.close() }\n+                \n+                // wait for connected state\n+                waitUntil(timeout: testTimeout) { done in\n+                    realtime.connection.once(.Connected) { stateChange in\n+                        expect(stateChange!.reason).to(beNil())\n+                        expect(stateChange?.current).to(equal(realtime.connection.state))\n+                        done()\n+                    }\n+                    realtime.connect()\n+                }\n+                \n+                // create a `rightchannel` channel and check can't attach to it\n+                let channel = realtime.channels.get(\"rightchannel\")\n+                \n+                waitUntil(timeout: testTimeout) { done in\n+                    channel.attach() { error in\n+                        expect(error).toNot(beNil())\n+                        expect(error!.code).to(equal(40160))\n+                        done()\n+                    }\n+                }\n+                \n+                // get second token\n+                let secondTokenParams = ARTTokenParams()\n+                secondTokenParams.capability = \"{\\\"wrongchannel\\\": [\\\"*\\\"], \\\"rightchannel\\\": [\\\"*\\\"]}\"\n+                secondTokenParams.clientId = \"testClientId\"\n+                \n+                var secondToken = \"\"\n+                var secondTokenDetails: ARTTokenDetails?\n+                \n+                waitUntil(timeout: testTimeout) { done in\n+                    rest.auth.requestToken(secondTokenParams, withOptions: nil) { tokenDetails, error in\n+                        expect(error).to(beNil())\n+                        expect(tokenDetails).toNot(beNil())\n+                        \n+                        secondToken = tokenDetails!.token\n+                        secondTokenDetails = tokenDetails\n+                        done()\n+                    }\n+                }\n+                expect(secondToken).toNot(beNil())\n+                expect(secondToken.characters.count > 0).to(beTrue())\n+                expect(secondToken).toNot(equal(firstToken))\n+                \n+                // reauthorise\n+                let reauthOptions = ARTAuthOptions();\n+                reauthOptions.tokenDetails = secondTokenDetails\n+                reauthOptions.force = true\n+                \n+                waitUntil(timeout: testTimeout) { done in\n+                    realtime.auth.authorise(nil, options: reauthOptions) { reauthTokenDetails, error in\n+                        expect(error).to(beNil())\n+                        expect(reauthTokenDetails?.token).toNot(beNil())\n+                        done()\n+                    }\n+                }\n+                \n+                // re-attach to the channel\n+                waitUntil(timeout: testTimeout) { done in\n+                    channel.attach() { error in\n+                        expect(error).toNot(beNil())\n+                        expect(error!.code).to(equal(40160))","path":"Spec/Auth.swift","position":138,"original_position":138,"commit_id":"043cfa1156283e64730b9000cd12b26b1f10421c","original_commit_id":"043cfa1156283e64730b9000cd12b26b1f10421c","user":{"login":"EvgenyKarkan","id":2069158,"avatar_url":"https://avatars.githubusercontent.com/u/2069158?v=3","gravatar_id":"","url":"https://api.github.com/users/EvgenyKarkan","html_url":"https://github.com/EvgenyKarkan","followers_url":"https://api.github.com/users/EvgenyKarkan/followers","following_url":"https://api.github.com/users/EvgenyKarkan/following{/other_user}","gists_url":"https://api.github.com/users/EvgenyKarkan/gists{/gist_id}","starred_url":"https://api.github.com/users/EvgenyKarkan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EvgenyKarkan/subscriptions","organizations_url":"https://api.github.com/users/EvgenyKarkan/orgs","repos_url":"https://api.github.com/users/EvgenyKarkan/repos","events_url":"https://api.github.com/users/EvgenyKarkan/events{/privacy}","received_events_url":"https://api.github.com/users/EvgenyKarkan/received_events","type":"User","site_admin":false},"body":"Got it, well, currently it fails in red, because lib code not yet written for test to be green in TDD manner.  In future I won't include anymore such red tests. Thanks.","created_at":"2016-09-01T11:49:41Z","updated_at":"2016-09-01T11:49:41Z","html_url":"https://github.com/ably/ably-ios/pull/487#discussion_r77158852","pull_request_url":"https://api.github.com/repos/ably/ably-ios/pulls/487","_links":{"self":{"href":"https://api.github.com/repos/ably/ably-ios/pulls/comments/77158852"},"html":{"href":"https://github.com/ably/ably-ios/pull/487#discussion_r77158852"},"pull_request":{"href":"https://api.github.com/repos/ably/ably-ios/pulls/487"}}},"pull_request":{"url":"https://api.github.com/repos/ably/ably-ios/pulls/487","id":83488810,"html_url":"https://github.com/ably/ably-ios/pull/487","diff_url":"https://github.com/ably/ably-ios/pull/487.diff","patch_url":"https://github.com/ably/ably-ios/pull/487.patch","issue_url":"https://api.github.com/repos/ably/ably-ios/issues/487","number":487,"state":"open","locked":false,"title":"Rsa8e","user":{"login":"EvgenyKarkan","id":2069158,"avatar_url":"https://avatars.githubusercontent.com/u/2069158?v=3","gravatar_id":"","url":"https://api.github.com/users/EvgenyKarkan","html_url":"https://github.com/EvgenyKarkan","followers_url":"https://api.github.com/users/EvgenyKarkan/followers","following_url":"https://api.github.com/users/EvgenyKarkan/following{/other_user}","gists_url":"https://api.github.com/users/EvgenyKarkan/gists{/gist_id}","starred_url":"https://api.github.com/users/EvgenyKarkan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EvgenyKarkan/subscriptions","organizations_url":"https://api.github.com/users/EvgenyKarkan/orgs","repos_url":"https://api.github.com/users/EvgenyKarkan/repos","events_url":"https://api.github.com/users/EvgenyKarkan/events{/privacy}","received_events_url":"https://api.github.com/users/EvgenyKarkan/received_events","type":"User","site_admin":false},"body":"As a step by step part of https://github.com/ably/docs/pull/113/files","created_at":"2016-08-31T16:46:03Z","updated_at":"2016-09-01T11:49:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0cc61b27c6a95eabee5b101f2d2cb99972f0dc42","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/ably/ably-ios/pulls/487/commits","review_comments_url":"https://api.github.com/repos/ably/ably-ios/pulls/487/comments","review_comment_url":"https://api.github.com/repos/ably/ably-ios/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ably/ably-ios/issues/487/comments","statuses_url":"https://api.github.com/repos/ably/ably-ios/statuses/043cfa1156283e64730b9000cd12b26b1f10421c","head":{"label":"ably:RSA8e","ref":"RSA8e","sha":"043cfa1156283e64730b9000cd12b26b1f10421c","user":{"login":"ably","id":1859245,"avatar_url":"https://avatars.githubusercontent.com/u/1859245?v=3","gravatar_id":"","url":"https://api.github.com/users/ably","html_url":"https://github.com/ably","followers_url":"https://api.github.com/users/ably/followers","following_url":"https://api.github.com/users/ably/following{/other_user}","gists_url":"https://api.github.com/users/ably/gists{/gist_id}","starred_url":"https://api.github.com/users/ably/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ably/subscriptions","organizations_url":"https://api.github.com/users/ably/orgs","repos_url":"https://api.github.com/users/ably/repos","events_url":"https://api.github.com/users/ably/events{/privacy}","received_events_url":"https://api.github.com/users/ably/received_events","type":"Organization","site_admin":false},"repo":{"id":27377471,"name":"ably-ios","full_name":"ably/ably-ios","owner":{"login":"ably","id":1859245,"avatar_url":"https://avatars.githubusercontent.com/u/1859245?v=3","gravatar_id":"","url":"https://api.github.com/users/ably","html_url":"https://github.com/ably","followers_url":"https://api.github.com/users/ably/followers","following_url":"https://api.github.com/users/ably/following{/other_user}","gists_url":"https://api.github.com/users/ably/gists{/gist_id}","starred_url":"https://api.github.com/users/ably/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ably/subscriptions","organizations_url":"https://api.github.com/users/ably/orgs","repos_url":"https://api.github.com/users/ably/repos","events_url":"https://api.github.com/users/ably/events{/privacy}","received_events_url":"https://api.github.com/users/ably/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ably/ably-ios","description":"iOS Objective-C client for Ably real-time messaging service","fork":false,"url":"https://api.github.com/repos/ably/ably-ios","forks_url":"https://api.github.com/repos/ably/ably-ios/forks","keys_url":"https://api.github.com/repos/ably/ably-ios/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ably/ably-ios/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ably/ably-ios/teams","hooks_url":"https://api.github.com/repos/ably/ably-ios/hooks","issue_events_url":"https://api.github.com/repos/ably/ably-ios/issues/events{/number}","events_url":"https://api.github.com/repos/ably/ably-ios/events","assignees_url":"https://api.github.com/repos/ably/ably-ios/assignees{/user}","branches_url":"https://api.github.com/repos/ably/ably-ios/branches{/branch}","tags_url":"https://api.github.com/repos/ably/ably-ios/tags","blobs_url":"https://api.github.com/repos/ably/ably-ios/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ably/ably-ios/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ably/ably-ios/git/refs{/sha}","trees_url":"https://api.github.com/repos/ably/ably-ios/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ably/ably-ios/statuses/{sha}","languages_url":"https://api.github.com/repos/ably/ably-ios/languages","stargazers_url":"https://api.github.com/repos/ably/ably-ios/stargazers","contributors_url":"https://api.github.com/repos/ably/ably-ios/contributors","subscribers_url":"https://api.github.com/repos/ably/ably-ios/subscribers","subscription_url":"https://api.github.com/repos/ably/ably-ios/subscription","commits_url":"https://api.github.com/repos/ably/ably-ios/commits{/sha}","git_commits_url":"https://api.github.com/repos/ably/ably-ios/git/commits{/sha}","comments_url":"https://api.github.com/repos/ably/ably-ios/comments{/number}","issue_comment_url":"https://api.github.com/repos/ably/ably-ios/issues/comments{/number}","contents_url":"https://api.github.com/repos/ably/ably-ios/contents/{+path}","compare_url":"https://api.github.com/repos/ably/ably-ios/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ably/ably-ios/merges","archive_url":"https://api.github.com/repos/ably/ably-ios/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ably/ably-ios/downloads","issues_url":"https://api.github.com/repos/ably/ably-ios/issues{/number}","pulls_url":"https://api.github.com/repos/ably/ably-ios/pulls{/number}","milestones_url":"https://api.github.com/repos/ably/ably-ios/milestones{/number}","notifications_url":"https://api.github.com/repos/ably/ably-ios/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ably/ably-ios/labels{/name}","releases_url":"https://api.github.com/repos/ably/ably-ios/releases{/id}","deployments_url":"https://api.github.com/repos/ably/ably-ios/deployments","created_at":"2014-12-01T12:00:37Z","updated_at":"2016-08-22T14:07:36Z","pushed_at":"2016-08-31T17:23:50Z","git_url":"git://github.com/ably/ably-ios.git","ssh_url":"git@github.com:ably/ably-ios.git","clone_url":"https://github.com/ably/ably-ios.git","svn_url":"https://github.com/ably/ably-ios","homepage":null,"size":2993,"stargazers_count":3,"watchers_count":3,"language":"Swift","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":29,"forks":8,"open_issues":29,"watchers":3,"default_branch":"master"}},"base":{"label":"ably:master","ref":"master","sha":"d4800d6a3570e3da69994e86826f2a918b7a2dbb","user":{"login":"ably","id":1859245,"avatar_url":"https://avatars.githubusercontent.com/u/1859245?v=3","gravatar_id":"","url":"https://api.github.com/users/ably","html_url":"https://github.com/ably","followers_url":"https://api.github.com/users/ably/followers","following_url":"https://api.github.com/users/ably/following{/other_user}","gists_url":"https://api.github.com/users/ably/gists{/gist_id}","starred_url":"https://api.github.com/users/ably/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ably/subscriptions","organizations_url":"https://api.github.com/users/ably/orgs","repos_url":"https://api.github.com/users/ably/repos","events_url":"https://api.github.com/users/ably/events{/privacy}","received_events_url":"https://api.github.com/users/ably/received_events","type":"Organization","site_admin":false},"repo":{"id":27377471,"name":"ably-ios","full_name":"ably/ably-ios","owner":{"login":"ably","id":1859245,"avatar_url":"https://avatars.githubusercontent.com/u/1859245?v=3","gravatar_id":"","url":"https://api.github.com/users/ably","html_url":"https://github.com/ably","followers_url":"https://api.github.com/users/ably/followers","following_url":"https://api.github.com/users/ably/following{/other_user}","gists_url":"https://api.github.com/users/ably/gists{/gist_id}","starred_url":"https://api.github.com/users/ably/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ably/subscriptions","organizations_url":"https://api.github.com/users/ably/orgs","repos_url":"https://api.github.com/users/ably/repos","events_url":"https://api.github.com/users/ably/events{/privacy}","received_events_url":"https://api.github.com/users/ably/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ably/ably-ios","description":"iOS Objective-C client for Ably real-time messaging service","fork":false,"url":"https://api.github.com/repos/ably/ably-ios","forks_url":"https://api.github.com/repos/ably/ably-ios/forks","keys_url":"https://api.github.com/repos/ably/ably-ios/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ably/ably-ios/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ably/ably-ios/teams","hooks_url":"https://api.github.com/repos/ably/ably-ios/hooks","issue_events_url":"https://api.github.com/repos/ably/ably-ios/issues/events{/number}","events_url":"https://api.github.com/repos/ably/ably-ios/events","assignees_url":"https://api.github.com/repos/ably/ably-ios/assignees{/user}","branches_url":"https://api.github.com/repos/ably/ably-ios/branches{/branch}","tags_url":"https://api.github.com/repos/ably/ably-ios/tags","blobs_url":"https://api.github.com/repos/ably/ably-ios/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ably/ably-ios/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ably/ably-ios/git/refs{/sha}","trees_url":"https://api.github.com/repos/ably/ably-ios/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ably/ably-ios/statuses/{sha}","languages_url":"https://api.github.com/repos/ably/ably-ios/languages","stargazers_url":"https://api.github.com/repos/ably/ably-ios/stargazers","contributors_url":"https://api.github.com/repos/ably/ably-ios/contributors","subscribers_url":"https://api.github.com/repos/ably/ably-ios/subscribers","subscription_url":"https://api.github.com/repos/ably/ably-ios/subscription","commits_url":"https://api.github.com/repos/ably/ably-ios/commits{/sha}","git_commits_url":"https://api.github.com/repos/ably/ably-ios/git/commits{/sha}","comments_url":"https://api.github.com/repos/ably/ably-ios/comments{/number}","issue_comment_url":"https://api.github.com/repos/ably/ably-ios/issues/comments{/number}","contents_url":"https://api.github.com/repos/ably/ably-ios/contents/{+path}","compare_url":"https://api.github.com/repos/ably/ably-ios/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ably/ably-ios/merges","archive_url":"https://api.github.com/repos/ably/ably-ios/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ably/ably-ios/downloads","issues_url":"https://api.github.com/repos/ably/ably-ios/issues{/number}","pulls_url":"https://api.github.com/repos/ably/ably-ios/pulls{/number}","milestones_url":"https://api.github.com/repos/ably/ably-ios/milestones{/number}","notifications_url":"https://api.github.com/repos/ably/ably-ios/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ably/ably-ios/labels{/name}","releases_url":"https://api.github.com/repos/ably/ably-ios/releases{/id}","deployments_url":"https://api.github.com/repos/ably/ably-ios/deployments","created_at":"2014-12-01T12:00:37Z","updated_at":"2016-08-22T14:07:36Z","pushed_at":"2016-08-31T17:23:50Z","git_url":"git://github.com/ably/ably-ios.git","ssh_url":"git@github.com:ably/ably-ios.git","clone_url":"https://github.com/ably/ably-ios.git","svn_url":"https://github.com/ably/ably-ios","homepage":null,"size":2993,"stargazers_count":3,"watchers_count":3,"language":"Swift","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":29,"forks":8,"open_issues":29,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ably/ably-ios/pulls/487"},"html":{"href":"https://github.com/ably/ably-ios/pull/487"},"issue":{"href":"https://api.github.com/repos/ably/ably-ios/issues/487"},"comments":{"href":"https://api.github.com/repos/ably/ably-ios/issues/487/comments"},"review_comments":{"href":"https://api.github.com/repos/ably/ably-ios/pulls/487/comments"},"review_comment":{"href":"https://api.github.com/repos/ably/ably-ios/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ably/ably-ios/pulls/487/commits"},"statuses":{"href":"https://api.github.com/repos/ably/ably-ios/statuses/043cfa1156283e64730b9000cd12b26b1f10421c"}}}}
{"actor":{"display_login":"EvgenyKarkan"}}