{"action":"created","issue":{"url":"https://api.github.com/repos/seegno/angular-oauth2/issues/69","labels_url":"https://api.github.com/repos/seegno/angular-oauth2/issues/69/labels{/name}","comments_url":"https://api.github.com/repos/seegno/angular-oauth2/issues/69/comments","events_url":"https://api.github.com/repos/seegno/angular-oauth2/issues/69/events","html_url":"https://github.com/seegno/angular-oauth2/issues/69","id":113301113,"number":69,"title":"Authorization header is always sent","user":{"login":"SamiSammour","id":8644403,"avatar_url":"https://avatars.githubusercontent.com/u/8644403?v=3","gravatar_id":"","url":"https://api.github.com/users/SamiSammour","html_url":"https://github.com/SamiSammour","followers_url":"https://api.github.com/users/SamiSammour/followers","following_url":"https://api.github.com/users/SamiSammour/following{/other_user}","gists_url":"https://api.github.com/users/SamiSammour/gists{/gist_id}","starred_url":"https://api.github.com/users/SamiSammour/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SamiSammour/subscriptions","organizations_url":"https://api.github.com/users/SamiSammour/orgs","repos_url":"https://api.github.com/users/SamiSammour/repos","events_url":"https://api.github.com/users/SamiSammour/events{/privacy}","received_events_url":"https://api.github.com/users/SamiSammour/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-10-26T07:44:47Z","updated_at":"2015-12-10T08:58:49Z","closed_at":null,"body":"I have an issue concerning the interceptor, my problem is that it is adding the Authorization header to all requests including the getAccessToken & getRefreshToken, and this triggers a preflight request which is not supported from the server side.\r\nI had to add the following code in the interceptor:\r\n```\r\nrequest: function(config) {\r\n    // don't add the authorization header when the client is requesting a new token or refreshing one.\r\n    if (angular.isDefined(config.data)) {\r\n        var data = queryString.parse(config.data);\r\n        if (angular.isDefined(data.grant_type) && (data.grant_type === 'password' || data.grant_type === 'refresh_token')) {\r\n            return config;\r\n        }\r\n    }\r\n    if (OAuthToken.getAuthorizationHeader()) {\r\n        config.headers = config.headers || {};\r\n        config.headers.Authorization = OAuthToken.getAuthorizationHeader();\r\n    }\r\n    return config;\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/seegno/angular-oauth2/issues/comments/163537654","html_url":"https://github.com/seegno/angular-oauth2/issues/69#issuecomment-163537654","issue_url":"https://api.github.com/repos/seegno/angular-oauth2/issues/69","id":163537654,"user":{"login":"SamiSammour","id":8644403,"avatar_url":"https://avatars.githubusercontent.com/u/8644403?v=3","gravatar_id":"","url":"https://api.github.com/users/SamiSammour","html_url":"https://github.com/SamiSammour","followers_url":"https://api.github.com/users/SamiSammour/followers","following_url":"https://api.github.com/users/SamiSammour/following{/other_user}","gists_url":"https://api.github.com/users/SamiSammour/gists{/gist_id}","starred_url":"https://api.github.com/users/SamiSammour/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SamiSammour/subscriptions","organizations_url":"https://api.github.com/users/SamiSammour/orgs","repos_url":"https://api.github.com/users/SamiSammour/repos","events_url":"https://api.github.com/users/SamiSammour/events{/privacy}","received_events_url":"https://api.github.com/users/SamiSammour/received_events","type":"User","site_admin":false},"created_at":"2015-12-10T08:58:49Z","updated_at":"2015-12-10T08:58:49Z","body":"I solved my problem by creating my own interceptor \r\n```javascript\r\n'use strict';\r\n\r\nangular.module('app')\r\n.factory('authorizationInterceptor', function() {\r\n  return {\r\n    request: function(config) {\r\n      // don't add the authorization header when the client is requesting a new token or refreshing one.\r\n      if (angular.isDefined(config.data)) {\r\n        var data = queryString.parse(config.data);\r\n        if (angular.isDefined(data.grant_type) && (data.grant_type === 'password' || data.grant_type === 'refresh_token')) {\r\n          if (angular.isDefined(config.headers.Authorization)) {\r\n            delete config.headers.Authorization;\r\n          }\r\n        }\r\n      }\r\n      return config;\r\n    }\r\n  };\r\n});\r\n```\r\nand added it in my config\r\n```javascript\r\n$httpProvider.interceptors.push('authorizationInterceptor');\r\n```"}}