{"action":"created","issue":{"url":"https://api.github.com/repos/IdentityModel/oidc-token-manager/issues/29","labels_url":"https://api.github.com/repos/IdentityModel/oidc-token-manager/issues/29/labels{/name}","comments_url":"https://api.github.com/repos/IdentityModel/oidc-token-manager/issues/29/comments","events_url":"https://api.github.com/repos/IdentityModel/oidc-token-manager/issues/29/events","html_url":"https://github.com/IdentityModel/oidc-token-manager/issues/29","id":118833909,"number":29,"title":"Promise error when using RequireJS","user":{"login":"promontis","id":374646,"avatar_url":"https://avatars.githubusercontent.com/u/374646?v=3","gravatar_id":"","url":"https://api.github.com/users/promontis","html_url":"https://github.com/promontis","followers_url":"https://api.github.com/users/promontis/followers","following_url":"https://api.github.com/users/promontis/following{/other_user}","gists_url":"https://api.github.com/users/promontis/gists{/gist_id}","starred_url":"https://api.github.com/users/promontis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/promontis/subscriptions","organizations_url":"https://api.github.com/users/promontis/orgs","repos_url":"https://api.github.com/users/promontis/repos","events_url":"https://api.github.com/users/promontis/events{/privacy}","received_events_url":"https://api.github.com/users/promontis/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-11-25T13:13:13Z","updated_at":"2015-11-25T13:15:54Z","closed_at":null,"body":"Hi guys,\r\n\r\nWe've been seeing an error when using the oidc-token-manager within IE11 while using RequireJS (http://requirejs.org/).\r\n\r\n```Unable to get property 'Promise' of undefined or null reference```\r\n\r\nThe error is because of the following piece of code:\r\n```\r\n    /* global define:true module:true window: true */\r\n    if (typeof define === 'function' && define['amd']) {\r\n      define(function() { return es6$promise$umd$$ES6Promise; });\r\n    } else if (typeof module !== 'undefined' && module['exports']) {\r\n      module['exports'] = es6$promise$umd$$ES6Promise;\r\n    } else if (typeof this !== 'undefined') {\r\n      this['ES6Promise'] = es6$promise$umd$$ES6Promise;\r\n    }\r\n\r\n    window.Promise = window.Promise || this['ES6Promise'].Promise; // do this to access Promise directly\r\n```\r\n\r\nRequireJS uses ```define``` to load its modules. It also has a valid 'amd' object. This will match the first condition and will let the library use ES6 promises. However, IE11 doesn't seem to support this.\r\n\r\nThe solution should be to improve the first condition to allow the use of RequireJS. I think you'll need to use a different condition for checking if the library should use ES6 promises."},"comment":{"url":"https://api.github.com/repos/IdentityModel/oidc-token-manager/issues/comments/159604416","html_url":"https://github.com/IdentityModel/oidc-token-manager/issues/29#issuecomment-159604416","issue_url":"https://api.github.com/repos/IdentityModel/oidc-token-manager/issues/29","id":159604416,"user":{"login":"promontis","id":374646,"avatar_url":"https://avatars.githubusercontent.com/u/374646?v=3","gravatar_id":"","url":"https://api.github.com/users/promontis","html_url":"https://github.com/promontis","followers_url":"https://api.github.com/users/promontis/followers","following_url":"https://api.github.com/users/promontis/following{/other_user}","gists_url":"https://api.github.com/users/promontis/gists{/gist_id}","starred_url":"https://api.github.com/users/promontis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/promontis/subscriptions","organizations_url":"https://api.github.com/users/promontis/orgs","repos_url":"https://api.github.com/users/promontis/repos","events_url":"https://api.github.com/users/promontis/events{/privacy}","received_events_url":"https://api.github.com/users/promontis/received_events","type":"User","site_admin":false},"created_at":"2015-11-25T13:15:54Z","updated_at":"2015-11-25T13:15:54Z","body":"We also get this error when running unit tests in PhantomJS. Same issue: RequireJS will let the library use ES6 promises, but PhantomJS doesn't seem to support it"}}