{"action":"created","issue":{"url":"https://api.github.com/repos/lynndylanhurley/ng-token-auth/issues/311","repository_url":"https://api.github.com/repos/lynndylanhurley/ng-token-auth","labels_url":"https://api.github.com/repos/lynndylanhurley/ng-token-auth/issues/311/labels{/name}","comments_url":"https://api.github.com/repos/lynndylanhurley/ng-token-auth/issues/311/comments","events_url":"https://api.github.com/repos/lynndylanhurley/ng-token-auth/issues/311/events","html_url":"https://github.com/lynndylanhurley/ng-token-auth/issues/311","id":167391271,"number":311,"title":"Ionic/Android 'requestCredentials is not defined'","user":{"login":"RyanMilstead1","id":6655143,"avatar_url":"https://avatars.githubusercontent.com/u/6655143?v=3","gravatar_id":"","url":"https://api.github.com/users/RyanMilstead1","html_url":"https://github.com/RyanMilstead1","followers_url":"https://api.github.com/users/RyanMilstead1/followers","following_url":"https://api.github.com/users/RyanMilstead1/following{/other_user}","gists_url":"https://api.github.com/users/RyanMilstead1/gists{/gist_id}","starred_url":"https://api.github.com/users/RyanMilstead1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RyanMilstead1/subscriptions","organizations_url":"https://api.github.com/users/RyanMilstead1/orgs","repos_url":"https://api.github.com/users/RyanMilstead1/repos","events_url":"https://api.github.com/users/RyanMilstead1/events{/privacy}","received_events_url":"https://api.github.com/users/RyanMilstead1/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-07-25T15:14:19Z","updated_at":"2016-09-26T14:12:50Z","closed_at":null,"body":"Good morning all,\r\n\r\nI've been banging my head against a wall trying to figure out this issue so I come to you, who have hopefully dealt with something like this and are far smarter than I.\r\n\r\nI'm building an ionic app with a rails api backend. Implemented ng-token-auth/devise-token-auth and everything works smoothly for regular login as well as social media login when running the app on my local machine via `ionic serve`\r\n\r\nOnce I build the code and attempt to test on my android tablet via `ionic run android`, the app loads normally, I click one of the social media login buttons and the inAppBroswer opens per my configuration to the social media login page. I enter my credentials, the rails api is hits on the OmniauthCallbacksController successfully, returning a 200.\r\n\r\nThen the browser hangs on a white page and I receive this in the android logs:\r\n\"Uncaught ReferenceError: requestCredentials is not defined\"\r\n\r\nI've traced this down to this particular place in the ng-token-auth code:\r\n```javascript\r\n            handleLoadStop: function(authWindow) {\r\n              _this = this;\r\n              return authWindow.executeScript({\r\n                //BREAKS HERE\r\n                code: 'requestCredentials()'\r\n              }, function(response) {\r\n                var data, ev;\r\n                data = response[0];\r\n                if (data) {\r\n                  ev = new Event('message');\r\n                  ev.data = data;\r\n                  _this.cancelOmniauthInAppBrowserListeners();\r\n                  $window.dispatchEvent(ev);\r\n                  _this.initDfd();\r\n                  return authWindow.close();\r\n                }\r\n              });\r\n            },\r\n```\r\n\r\nI've tried to implement the various solutions in previous issues #90 and #141 to no avail. Any help that could be provided would be greatly appreciated!"},"comment":{"url":"https://api.github.com/repos/lynndylanhurley/ng-token-auth/issues/comments/249580937","html_url":"https://github.com/lynndylanhurley/ng-token-auth/issues/311#issuecomment-249580937","issue_url":"https://api.github.com/repos/lynndylanhurley/ng-token-auth/issues/311","id":249580937,"user":{"login":"aL3xa","id":321826,"avatar_url":"https://avatars.githubusercontent.com/u/321826?v=3","gravatar_id":"","url":"https://api.github.com/users/aL3xa","html_url":"https://github.com/aL3xa","followers_url":"https://api.github.com/users/aL3xa/followers","following_url":"https://api.github.com/users/aL3xa/following{/other_user}","gists_url":"https://api.github.com/users/aL3xa/gists{/gist_id}","starred_url":"https://api.github.com/users/aL3xa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aL3xa/subscriptions","organizations_url":"https://api.github.com/users/aL3xa/orgs","repos_url":"https://api.github.com/users/aL3xa/repos","events_url":"https://api.github.com/users/aL3xa/events{/privacy}","received_events_url":"https://api.github.com/users/aL3xa/received_events","type":"User","site_admin":false},"created_at":"2016-09-26T14:12:49Z","updated_at":"2016-09-26T14:12:49Z","body":"I can confirm bug on Android using **cordova** v6.3.1, with `ng-token-auth` commit ebfdf59 and `devise_token_auth` commit [`536911c`](https://github.com/lynndylanhurley/devise_token_auth/commit/536911c7d3f178637423b77fe1179388ddf62b9e).\r\n\r\n@RyanMilstead1 did you manage to find fix/workaround in the meantime?\r\n\r\nFTR, auth process works just fine on non-cordova projects, both with `sameWindow` and `newWindow` `omniauthWindowType` option."}}
{"actor":{"display_login":"aL3xa"}}