{"action":"created","issue":{"url":"https://api.github.com/repos/ably/ably-java/issues/40","labels_url":"https://api.github.com/repos/ably/ably-java/issues/40/labels{/name}","comments_url":"https://api.github.com/repos/ably/ably-java/issues/40/comments","events_url":"https://api.github.com/repos/ably/ably-java/issues/40/events","html_url":"https://github.com/ably/ably-java/issues/40","id":103062423,"number":40,"title":"Token authentication \"Request mac doesn't match\"","user":{"login":"stannedelchev","id":590590,"avatar_url":"https://avatars.githubusercontent.com/u/590590?v=3","gravatar_id":"","url":"https://api.github.com/users/stannedelchev","html_url":"https://github.com/stannedelchev","followers_url":"https://api.github.com/users/stannedelchev/followers","following_url":"https://api.github.com/users/stannedelchev/following{/other_user}","gists_url":"https://api.github.com/users/stannedelchev/gists{/gist_id}","starred_url":"https://api.github.com/users/stannedelchev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stannedelchev/subscriptions","organizations_url":"https://api.github.com/users/stannedelchev/orgs","repos_url":"https://api.github.com/users/stannedelchev/repos","events_url":"https://api.github.com/users/stannedelchev/events{/privacy}","received_events_url":"https://api.github.com/users/stannedelchev/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ably/ably-java/labels/bug","name":"bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":{"login":"paddybyers","id":1137574,"avatar_url":"https://avatars.githubusercontent.com/u/1137574?v=3","gravatar_id":"","url":"https://api.github.com/users/paddybyers","html_url":"https://github.com/paddybyers","followers_url":"https://api.github.com/users/paddybyers/followers","following_url":"https://api.github.com/users/paddybyers/following{/other_user}","gists_url":"https://api.github.com/users/paddybyers/gists{/gist_id}","starred_url":"https://api.github.com/users/paddybyers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paddybyers/subscriptions","organizations_url":"https://api.github.com/users/paddybyers/orgs","repos_url":"https://api.github.com/users/paddybyers/repos","events_url":"https://api.github.com/users/paddybyers/events{/privacy}","received_events_url":"https://api.github.com/users/paddybyers/received_events","type":"User","site_admin":false},"milestone":null,"comments":4,"created_at":"2015-08-25T16:13:43Z","updated_at":"2015-08-28T15:05:16Z","closed_at":"2015-08-28T15:05:16Z","body":"I'm trying to use the same pattern for connecting to Ably as [the one I'm using in the cordova demo app](https://github.com/ably/demo-mobile-phonegap-cordova/blob/master/www/js/app.js#L99) - providing clientId and authUrl to the Realtime instance.\r\n\r\n    app.ably = new Ably.Realtime({\r\n        authUrl: 'https://www.ably.io/ably-auth/token-request/demos',\r\n        clientId: clientId,\r\n        log: { level: 4 }\r\n    });\r\n\r\nHowever, running similar code (listing below) on Android, I'm getting a `Request mac doesn't match` error. Connecting with `clientOptions.key = \"...\"`, instead of `authUrl` works fine. I have enabled the INTERNET permission in AndroidManifest.xml.\r\n\r\n```\r\nI/System.out﹕ Sending WAIT chunk\r\nI/System.out﹕ (INFO): io.ably.realtime.AblyRealtime: started\r\nI/System.out﹕ (INFO): Auth(): using token auth with authUrl\r\nI/System.out﹕ (VERBOSE): io.ably.transport.ConnectionManager: requestState(): requesting connecting; id = null\r\nI/System.out﹕ (VERBOSE): io.ably.transport.ConnectionManager: notifyState(): notifying connecting; id = null\r\nI/System.out﹕ (INFO): TokenAuth.authorise():\r\nI/System.out﹕ (INFO): TokenAuth.authorise(): requesting new token\r\nI/System.out﹕ (INFO): Auth.requestToken(): using token auth with auth_url\r\nW/DefaultRequestDirector﹕ Authentication error: Unable to respond to any of these challenges: {}\r\nI/System.out﹕ (ERROR): io.ably.http.Http: Error response from server: statusCode = 401; responseBody = {\r\nI/System.out﹕ \"error\": {\r\nI/System.out﹕ \"statusCode\": 401,\r\nI/System.out﹕ \"code\": 40101,\r\nI/System.out﹕ \"message\": \"Request mac does not match\",\r\nI/System.out﹕ \"serverId\": \"frontend.d00f.production-eu-central-1-A.i-12ef73d3\"\r\nI/System.out﹕ }\r\nI/System.out﹕ }\r\nI/System.out﹕ (ERROR): io.ably.transport.WebSocketTransport: Unexpected exception attempting connection; wsUri = wss://realtime.ably.io:443/\r\nI/System.out﹕ io.ably.types.AblyException: Request mac does not match\r\nI/System.out﹕ at io.ably.http.Http.handleResponse(Unknown Source)\r\nI/System.out﹕ at io.ably.http.Http.postForHost(Unknown Source)\r\nI/System.out﹕ at io.ably.http.Http.post(Unknown Source)\r\nI/System.out﹕ at io.ably.rest.Auth.requestToken(Unknown Source)\r\nI/System.out﹕ at io.ably.http.TokenAuth.authorise(Unknown Source)\r\nI/System.out﹕ at io.ably.rest.Auth.authorise(Unknown Source)\r\nI/System.out﹕ at io.ably.rest.Auth.getAuthParams(Unknown Source)\r\nI/System.out﹕ at io.ably.transport.WebSocketTransport.connect(Unknown Source)\r\nI/System.out﹕ at io.ably.transport.ConnectionManager.connectImpl(Unknown Source)\r\nI/System.out﹕ at io.ably.transport.ConnectionManager.handleStateRequest(Unknown Source)\r\nI/System.out﹕ at io.ably.transport.ConnectionManager.run(Unknown Source)\r\nI/System.out﹕ (VERBOSE): io.ably.transport.ConnectionManager: notifyState(): notifying disconnected; id = null\r\nI/System.out﹕ (VERBOSE): io.ably.transport.ConnectionManager: setState(): setting disconnected\r\nV/ABLY CONNECTION CHANGE﹕ Request mac does not match\r\n```\r\n\r\nCode:\r\n\r\n    @Override\r\n    protected void onResume() {\r\n        super.onResume();\r\n\r\n        try {\r\n            ClientOptions clientOptions = new ClientOptions();\r\n            clientOptions.logLevel = io.ably.util.Log.VERBOSE;\r\n            clientOptions.clientId = \"stan\";\r\n            clientOptions.authUrl = \"https://www.ably.io/ably-auth/token-request/demos\";\r\n            AblyRealtime realtime = new AblyRealtime(clientOptions);\r\n            realtime.connection.on(new ConnectionStateListener() {\r\n                @Override\r\n                public void onConnectionStateChanged(ConnectionStateChange connectionStateChange) {\r\n                    Log.v(\"ABLY CONNECTION CHANGE\", connectionStateChange.reason.message);\r\n                }\r\n            });\r\n        }\r\n        catch(AblyException e) {\r\n            e.printStackTrace();\r\n        }\r\n    }\r\n"},"comment":{"url":"https://api.github.com/repos/ably/ably-java/issues/comments/135799081","html_url":"https://github.com/ably/ably-java/issues/40#issuecomment-135799081","issue_url":"https://api.github.com/repos/ably/ably-java/issues/40","id":135799081,"user":{"login":"stannedelchev","id":590590,"avatar_url":"https://avatars.githubusercontent.com/u/590590?v=3","gravatar_id":"","url":"https://api.github.com/users/stannedelchev","html_url":"https://github.com/stannedelchev","followers_url":"https://api.github.com/users/stannedelchev/followers","following_url":"https://api.github.com/users/stannedelchev/following{/other_user}","gists_url":"https://api.github.com/users/stannedelchev/gists{/gist_id}","starred_url":"https://api.github.com/users/stannedelchev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stannedelchev/subscriptions","organizations_url":"https://api.github.com/users/stannedelchev/orgs","repos_url":"https://api.github.com/users/stannedelchev/repos","events_url":"https://api.github.com/users/stannedelchev/events{/privacy}","received_events_url":"https://api.github.com/users/stannedelchev/received_events","type":"User","site_admin":false},"created_at":"2015-08-28T15:05:16Z","updated_at":"2015-08-28T15:05:16Z","body":"Confirmed, latest `master` ( 8a11affa1272e1dd168b7dbe33595a9cd464ebf2 ) works fine."}}