{"action":"created","issue":{"url":"https://api.github.com/repos/auth0/angular2-jwt/issues/269","repository_url":"https://api.github.com/repos/auth0/angular2-jwt","labels_url":"https://api.github.com/repos/auth0/angular2-jwt/issues/269/labels{/name}","comments_url":"https://api.github.com/repos/auth0/angular2-jwt/issues/269/comments","events_url":"https://api.github.com/repos/auth0/angular2-jwt/issues/269/events","html_url":"https://github.com/auth0/angular2-jwt/issues/269","id":199994987,"number":269,"title":"Ionic2 Storage Support","user":{"login":"thielCole","id":7246257,"avatar_url":"https://avatars.githubusercontent.com/u/7246257?v=3","gravatar_id":"","url":"https://api.github.com/users/thielCole","html_url":"https://github.com/thielCole","followers_url":"https://api.github.com/users/thielCole/followers","following_url":"https://api.github.com/users/thielCole/following{/other_user}","gists_url":"https://api.github.com/users/thielCole/gists{/gist_id}","starred_url":"https://api.github.com/users/thielCole/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thielCole/subscriptions","organizations_url":"https://api.github.com/users/thielCole/orgs","repos_url":"https://api.github.com/users/thielCole/repos","events_url":"https://api.github.com/users/thielCole/events{/privacy}","received_events_url":"https://api.github.com/users/thielCole/received_events","type":"User","site_admin":false},"labels":[{"id":277925006,"url":"https://api.github.com/repos/auth0/angular2-jwt/labels/question","name":"question","color":"cc317c","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":14,"created_at":"2017-01-11T03:29:36Z","updated_at":"2017-01-25T06:39:51Z","closed_at":null,"body":"In the documentation, you reference this as the correct setup for an Ionic2 application. If you implement this correctly, it errors when trying to use Ionic2's storage (1.1.7) because storage.get() returns a promise instead of a string.\r\n\r\n```\r\nlet storage = new Storage();\r\n\r\nexport function getAuthHttp(http) {\r\n  return new AuthHttp(new AuthConfig({\r\n    headerPrefix: YOUR_HEADER_PREFIX,\r\n    noJwtError: true,\r\n    globalHeaders: [{'Accept': 'application/json'}],\r\n    tokenGetter: (() => storage.get('id_token')),\r\n  }), http);\r\n}\r\n```\r\n\r\nInstead of this implementation, to get this to work I had to use localStorage (from the global window object). \r\n\r\nExample\r\n\r\n```\r\nexport function getAuthHttp(http: Http, options: RequestOptions) {\r\n  return new AuthHttp(new AuthConfig({\r\n          tokenName: 'id_token',\r\n          headerPrefix: 'JWT',\r\n          tokenGetter: (() => localStorage.getItem('id_token')),\r\n          globalHeaders: [{'Content-Type':'application/json'}],\r\n     }), http, options);\r\n}\r\n```\r\n\r\nand when I log in and receive the token, I need to save it via local storage also.\r\n\r\n```\r\nlocalStorage.setItem('id_token', response.token);\r\n```\r\n\r\nFrom the documentation, you would expect the library to handle the ionic2 storage implementation.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/auth0/angular2-jwt/issues/comments/275031256","html_url":"https://github.com/auth0/angular2-jwt/issues/269#issuecomment-275031256","issue_url":"https://api.github.com/repos/auth0/angular2-jwt/issues/269","id":275031256,"user":{"login":"thielCole","id":7246257,"avatar_url":"https://avatars.githubusercontent.com/u/7246257?v=3","gravatar_id":"","url":"https://api.github.com/users/thielCole","html_url":"https://github.com/thielCole","followers_url":"https://api.github.com/users/thielCole/followers","following_url":"https://api.github.com/users/thielCole/following{/other_user}","gists_url":"https://api.github.com/users/thielCole/gists{/gist_id}","starred_url":"https://api.github.com/users/thielCole/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thielCole/subscriptions","organizations_url":"https://api.github.com/users/thielCole/orgs","repos_url":"https://api.github.com/users/thielCole/repos","events_url":"https://api.github.com/users/thielCole/events{/privacy}","received_events_url":"https://api.github.com/users/thielCole/received_events","type":"User","site_admin":false},"created_at":"2017-01-25T06:39:51Z","updated_at":"2017-01-25T06:39:51Z","body":"Ok so I have a repo here to test with.\r\n\r\nhttps://github.com/thielCole/localStorageJwt\r\n\r\nOnly issue is, I don't have an associated JWT and place to send said jwt... Do you have that setup?\r\n\r\nIf you look in\r\n```\r\nsrc/pages/home/home.tx\r\n\r\n\r\n  constructor(public navCtrl: NavController,\r\n              public authHttp: AuthHttp) {\r\n      // Set real token\r\n      this.local.set('id_token', 'jwt_token');\r\n  }\r\n\r\n  sendHttp() {\r\n    console.log('Send Http');\r\n    this.authHttp.get('http://google.com').subscribe( (data) => {\r\n      console.log('Got Data!');\r\n    });\r\n  }\r\n\r\n```\r\nThis is where we can test this..."}}
{"actor":{"display_login":"thielCole"}}