{"action":"created","issue":{"url":"https://api.github.com/repos/thetizzo/thetizzo.github.io/issues/1","repository_url":"https://api.github.com/repos/thetizzo/thetizzo.github.io","labels_url":"https://api.github.com/repos/thetizzo/thetizzo.github.io/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/thetizzo/thetizzo.github.io/issues/1/comments","events_url":"https://api.github.com/repos/thetizzo/thetizzo.github.io/issues/1/events","html_url":"https://github.com/thetizzo/thetizzo.github.io/issues/1","id":202140377,"number":1,"title":"Turbolinks 5 iOS auth","user":{"login":"mityakoval","id":10942685,"avatar_url":"https://avatars.githubusercontent.com/u/10942685?v=3","gravatar_id":"","url":"https://api.github.com/users/mityakoval","html_url":"https://github.com/mityakoval","followers_url":"https://api.github.com/users/mityakoval/followers","following_url":"https://api.github.com/users/mityakoval/following{/other_user}","gists_url":"https://api.github.com/users/mityakoval/gists{/gist_id}","starred_url":"https://api.github.com/users/mityakoval/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mityakoval/subscriptions","organizations_url":"https://api.github.com/users/mityakoval/orgs","repos_url":"https://api.github.com/users/mityakoval/repos","events_url":"https://api.github.com/users/mityakoval/events{/privacy}","received_events_url":"https://api.github.com/users/mityakoval/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-01-20T13:29:33Z","updated_at":"2017-01-20T22:34:34Z","closed_at":null,"body":"Hello Jason! We meet again :)\r\nI have just found your blog post about Turbolinks 5 for iOS authentication. And it happens that I am still struggling with it. I can't figure out how do we tell our AuthController that it had authenticated successfully. I don't use Devise or anything for authentication in my Rails app. Instead I have the following `before_filter`: \r\n\r\n```\r\ndef require_login\r\n  unless current_user\r\n    redirect_to login_url, status: :unauthorized\r\n  end\r\nend\r\n```\r\n\r\nSo it fires the error handling method in my iOS app and forces it to present AuthController.\r\n\r\nThen the auth form is submitted remotely (according to [this](https://github.com/turbolinks/turbolinks-ios#handling-form-submission)) and Rails responds with `js.erb` file that does `Turbolinks.visit('whatever')`\r\n\r\nBut it doesn't dismiss the AuthController after the successful login.\r\n\r\nI was trying to render that js-file with some success status code and check for it in iOS app, but there is no way to grab that code from Turbolinks unless it's an error (at least I couldn't find it). \r\n\r\nDo you have any thoughts?"},"comment":{"url":"https://api.github.com/repos/thetizzo/thetizzo.github.io/issues/comments/274198165","html_url":"https://github.com/thetizzo/thetizzo.github.io/issues/1#issuecomment-274198165","issue_url":"https://api.github.com/repos/thetizzo/thetizzo.github.io/issues/1","id":274198165,"user":{"login":"thetizzo","id":709926,"avatar_url":"https://avatars.githubusercontent.com/u/709926?v=3","gravatar_id":"","url":"https://api.github.com/users/thetizzo","html_url":"https://github.com/thetizzo","followers_url":"https://api.github.com/users/thetizzo/followers","following_url":"https://api.github.com/users/thetizzo/following{/other_user}","gists_url":"https://api.github.com/users/thetizzo/gists{/gist_id}","starred_url":"https://api.github.com/users/thetizzo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thetizzo/subscriptions","organizations_url":"https://api.github.com/users/thetizzo/orgs","repos_url":"https://api.github.com/users/thetizzo/repos","events_url":"https://api.github.com/users/thetizzo/events{/privacy}","received_events_url":"https://api.github.com/users/thetizzo/received_events","type":"User","site_admin":false},"created_at":"2017-01-20T22:34:34Z","updated_at":"2017-01-20T22:34:34Z","body":"I found that because the AuthController is separated from the rest of the views on the iOS side then you don't have to submit the form with XHR.  This way it closes the AuthController view in the app and loads your main Turbolinks enabled view controller."}}
{"actor":{"display_login":"thetizzo"}}