{"action":"created","issue":{"url":"https://api.github.com/repos/manfredsteyer/angular-oauth2-oidc/issues/471","repository_url":"https://api.github.com/repos/manfredsteyer/angular-oauth2-oidc","labels_url":"https://api.github.com/repos/manfredsteyer/angular-oauth2-oidc/issues/471/labels{/name}","comments_url":"https://api.github.com/repos/manfredsteyer/angular-oauth2-oidc/issues/471/comments","events_url":"https://api.github.com/repos/manfredsteyer/angular-oauth2-oidc/issues/471/events","html_url":"https://github.com/manfredsteyer/angular-oauth2-oidc/issues/471","id":380250900,"node_id":"MDU6SXNzdWUzODAyNTA5MDA=","number":471,"title":"angular-oauth2-oidc has no exported member 'createDefaultStorage'","user":{"login":"bergac","id":42515536,"node_id":"MDQ6VXNlcjQyNTE1NTM2","avatar_url":"https://avatars0.githubusercontent.com/u/42515536?v=4","gravatar_id":"","url":"https://api.github.com/users/bergac","html_url":"https://github.com/bergac","followers_url":"https://api.github.com/users/bergac/followers","following_url":"https://api.github.com/users/bergac/following{/other_user}","gists_url":"https://api.github.com/users/bergac/gists{/gist_id}","starred_url":"https://api.github.com/users/bergac/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bergac/subscriptions","organizations_url":"https://api.github.com/users/bergac/orgs","repos_url":"https://api.github.com/users/bergac/repos","events_url":"https://api.github.com/users/bergac/events{/privacy}","received_events_url":"https://api.github.com/users/bergac/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-11-13T14:26:03Z","updated_at":"2018-11-13T21:33:02Z","closed_at":null,"author_association":"NONE","body":"Hi,\r\n\r\nAfter updating to Angular 7.0.3 and angular-oauth2-oidc 5.0.2, our custom auth module doesn't work anymore, because during AOT compilation we get the following error:  \r\n`angular-oauth2-oidc has no exported member 'createDefaultStorage'`\r\n\r\nOur custom forRoot() method looks like this:\r\n```\r\nstatic forRoot(): ModuleWithProviders {\r\n    return {\r\n      ngModule: CustomAuthModule,\r\n      providers: [\r\n        OAuthService,\r\n        CustomAuthService,\r\n        UrlHelperService,\r\n        { provide: OAuthStorage, useFactory: createDefaultStorage, multi: false },\r\n        {\r\n          provide: OAuthResourceServerErrorHandler,\r\n          useClass: OAuthNoopResourceServerErrorHandler\r\n        },\r\n        { provide: OAuthModuleConfig, useValue:  CustomAuthModule.config },\r\n        {\r\n          provide: HTTP_INTERCEPTORS,\r\n          useClass:  CustomAuthInterceptor,\r\n          multi: true\r\n        }\r\n      ]\r\n    };\r\n  }\r\n```\r\n\r\nand we use the following imports from angular-oauth2-oidc:\r\n```\r\nimport {\r\n  OAuthModuleConfig, OAuthNoopResourceServerErrorHandler,\r\n  OAuthResourceServerErrorHandler,\r\n  OAuthService,\r\n  OAuthStorage,\r\n  UrlHelperService,\r\n  createDefaultStorage\r\n} from 'angular-oauth2-oidc';\r\n```\r\n\r\nI see that `createDefaultStorage` is not defined in `angular-oauth2-oidc.metadata.json`, could that be the problem?\r\n\r\nThanks in advance!"},"comment":{"url":"https://api.github.com/repos/manfredsteyer/angular-oauth2-oidc/issues/comments/438445386","html_url":"https://github.com/manfredsteyer/angular-oauth2-oidc/issues/471#issuecomment-438445386","issue_url":"https://api.github.com/repos/manfredsteyer/angular-oauth2-oidc/issues/471","id":438445386,"node_id":"MDEyOklzc3VlQ29tbWVudDQzODQ0NTM4Ng==","user":{"login":"jeroenheijmans","id":1590536,"node_id":"MDQ6VXNlcjE1OTA1MzY=","avatar_url":"https://avatars1.githubusercontent.com/u/1590536?v=4","gravatar_id":"","url":"https://api.github.com/users/jeroenheijmans","html_url":"https://github.com/jeroenheijmans","followers_url":"https://api.github.com/users/jeroenheijmans/followers","following_url":"https://api.github.com/users/jeroenheijmans/following{/other_user}","gists_url":"https://api.github.com/users/jeroenheijmans/gists{/gist_id}","starred_url":"https://api.github.com/users/jeroenheijmans/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeroenheijmans/subscriptions","organizations_url":"https://api.github.com/users/jeroenheijmans/orgs","repos_url":"https://api.github.com/users/jeroenheijmans/repos","events_url":"https://api.github.com/users/jeroenheijmans/events{/privacy}","received_events_url":"https://api.github.com/users/jeroenheijmans/received_events","type":"User","site_admin":false},"created_at":"2018-11-13T21:33:02Z","updated_at":"2018-11-13T21:33:02Z","author_association":"CONTRIBUTOR","body":"Not sure if `createDefaultStorage` was really ever intended to be exported outside the library? Given [how it worked in 4.0.2](https://github.com/manfredsteyer/angular-oauth2-oidc/blob/b4c87312f51b22ddb763ec1a8095d2ea6de07851/projects/lib/src/angular-oauth-oidic.module.ts#L18) and [how it works in master](https://github.com/manfredsteyer/angular-oauth2-oidc/blob/1eec310a188288e97cadffac7de1f592b187d153/projects/lib/src/factories.ts#L5) I'm still surprised that there's a difference though. I suspect that it's Angular 7's improved tree-shaking capabilities?\r\n\r\nRegardless, I suggest (also given the simplicity of the factory) just doing this if you don't need server side rendering:\r\n\r\n```typescript\r\n{ provide: OAuthStorage, useValue: sessionStorage }\r\n```\r\n\r\nor this if you do need SSR:\r\n\r\n```typescript\r\n{ provide: OAuthStorage, useValue: typeof sessionStorage !== 'undefined' ? sessionStorage : null }\r\n```\r\n\r\nLet us know if that solution/workaround worked for you."}}
{"actor":{"display_login":"jeroenheijmans"}}