{"action":"created","issue":{"url":"https://api.github.com/repos/rackt/react-router/issues/725","labels_url":"https://api.github.com/repos/rackt/react-router/issues/725/labels{/name}","comments_url":"https://api.github.com/repos/rackt/react-router/issues/725/comments","events_url":"https://api.github.com/repos/rackt/react-router/issues/725/events","html_url":"https://github.com/rackt/react-router/issues/725","id":55461793,"number":725,"title":"How to authenticate routes using Passport?","user":{"login":"hezjing","id":7230438,"avatar_url":"https://avatars.githubusercontent.com/u/7230438?v=3","gravatar_id":"","url":"https://api.github.com/users/hezjing","html_url":"https://github.com/hezjing","followers_url":"https://api.github.com/users/hezjing/followers","following_url":"https://api.github.com/users/hezjing/following{/other_user}","gists_url":"https://api.github.com/users/hezjing/gists{/gist_id}","starred_url":"https://api.github.com/users/hezjing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hezjing/subscriptions","organizations_url":"https://api.github.com/users/hezjing/orgs","repos_url":"https://api.github.com/users/hezjing/repos","events_url":"https://api.github.com/users/hezjing/events{/privacy}","received_events_url":"https://api.github.com/users/hezjing/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-01-26T09:32:21Z","updated_at":"2015-01-30T04:17:47Z","closed_at":null,"body":"Hi\r\n\r\nWith React Router, the routing is handled on the client side. May I know how do we authenticate the route the user is trying to access and redirect to a login page if he has not been authenticated?"},"comment":{"url":"https://api.github.com/repos/rackt/react-router/issues/comments/72152029","html_url":"https://github.com/rackt/react-router/issues/725#issuecomment-72152029","issue_url":"https://api.github.com/repos/rackt/react-router/issues/725","id":72152029,"user":{"login":"kilometers","id":6674848,"avatar_url":"https://avatars.githubusercontent.com/u/6674848?v=3","gravatar_id":"","url":"https://api.github.com/users/kilometers","html_url":"https://github.com/kilometers","followers_url":"https://api.github.com/users/kilometers/followers","following_url":"https://api.github.com/users/kilometers/following{/other_user}","gists_url":"https://api.github.com/users/kilometers/gists{/gist_id}","starred_url":"https://api.github.com/users/kilometers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kilometers/subscriptions","organizations_url":"https://api.github.com/users/kilometers/orgs","repos_url":"https://api.github.com/users/kilometers/repos","events_url":"https://api.github.com/users/kilometers/events{/privacy}","received_events_url":"https://api.github.com/users/kilometers/received_events","type":"User","site_admin":false},"created_at":"2015-01-30T04:17:47Z","updated_at":"2015-01-30T04:17:47Z","body":"https://github.com/rackt/react-router/blob/master/examples/auth-flow/app.js#L129-164\r\n\r\nNot only assumed, but implemented. From what I can tell the global `auth` object is meant to simulate an authentication API. In auth-flow's case it's using localstorage. However, even though Passport.js is running server-side you can create a similar solution with a few tweaks. On your server, create a few endpoints for authentication, such as `/login`, `/logout`, and even `/verify` if you wish. Client-side, for login, re-code `auth.login` to make an AJAX call to the `/login` endpoint and share the result with your React app."}}