{"action":"created","issue":{"url":"https://api.github.com/repos/jadjoubran/laravel5-angular-material-starter/issues/79","labels_url":"https://api.github.com/repos/jadjoubran/laravel5-angular-material-starter/issues/79/labels{/name}","comments_url":"https://api.github.com/repos/jadjoubran/laravel5-angular-material-starter/issues/79/comments","events_url":"https://api.github.com/repos/jadjoubran/laravel5-angular-material-starter/issues/79/events","html_url":"https://github.com/jadjoubran/laravel5-angular-material-starter/issues/79","id":111392127,"number":79,"title":"how to implement JWT authentication  in front end","user":{"login":"masterpowers","id":11954930,"avatar_url":"https://avatars.githubusercontent.com/u/11954930?v=3","gravatar_id":"","url":"https://api.github.com/users/masterpowers","html_url":"https://github.com/masterpowers","followers_url":"https://api.github.com/users/masterpowers/followers","following_url":"https://api.github.com/users/masterpowers/following{/other_user}","gists_url":"https://api.github.com/users/masterpowers/gists{/gist_id}","starred_url":"https://api.github.com/users/masterpowers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/masterpowers/subscriptions","organizations_url":"https://api.github.com/users/masterpowers/orgs","repos_url":"https://api.github.com/users/masterpowers/repos","events_url":"https://api.github.com/users/masterpowers/events{/privacy}","received_events_url":"https://api.github.com/users/masterpowers/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/jadjoubran/laravel5-angular-material-starter/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-10-14T12:55:50Z","updated_at":"2015-10-14T14:20:51Z","closed_at":null,"body":"I see you have a controller name `jwt_auth.js`\r\nunder this directory\r\n`angular/app/jwt_auth/jwt_auth.js`\r\n\r\nwhich can be called when i hit the url \r\n`authenticate/data`\r\n\r\nlikewise an `auth.js` file\r\nin the directory `angular/config/auth.js`\r\n\r\nwhich is responsible for  calling the url `api/authenticate/auth`\r\n\r\nnow my question is how i can implement this on the front end\r\ni know i will add something like this\r\n\r\n    $stateProvider\r\n                .state('auth', {\r\n                    url: '/auth',\r\n                    templateUrl: '../views/authView.html',\r\n                    controller: 'AuthController as auth'\r\n                })\r\n\r\nin the route.js\r\ndirectory is angular/route.js\r\n\r\nbut since the `jwt_auth.js` is not on the public folder.\r\nim looking for a way to add it in the front end\r\nsince i cant add it on script tag\r\nplease help\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/jadjoubran/laravel5-angular-material-starter/issues/comments/148064728","html_url":"https://github.com/jadjoubran/laravel5-angular-material-starter/issues/79#issuecomment-148064728","issue_url":"https://api.github.com/repos/jadjoubran/laravel5-angular-material-starter/issues/79","id":148064728,"user":{"login":"jadjoubran","id":2265232,"avatar_url":"https://avatars.githubusercontent.com/u/2265232?v=3","gravatar_id":"","url":"https://api.github.com/users/jadjoubran","html_url":"https://github.com/jadjoubran","followers_url":"https://api.github.com/users/jadjoubran/followers","following_url":"https://api.github.com/users/jadjoubran/following{/other_user}","gists_url":"https://api.github.com/users/jadjoubran/gists{/gist_id}","starred_url":"https://api.github.com/users/jadjoubran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jadjoubran/subscriptions","organizations_url":"https://api.github.com/users/jadjoubran/orgs","repos_url":"https://api.github.com/users/jadjoubran/repos","events_url":"https://api.github.com/users/jadjoubran/events{/privacy}","received_events_url":"https://api.github.com/users/jadjoubran/received_events","type":"User","site_admin":false},"created_at":"2015-10-14T14:20:51Z","updated_at":"2015-10-14T14:20:51Z","body":"This is how you can do it:\r\n\r\nRestangular.defaultHeaders['Authorization'] = 'Bearer ' + token;\r\n\r\nIt sets the default headers from now on which sends the Authorization: Bearer {token} requested by JWT.\r\nI haven't tried it though."}}