Last active
May 30, 2019 09:35
-
-
Save philly-vanilly/5fc9c94dbb36dfa67d7ce36161016897 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// sometimes you can't use window/document/location in AOT | |
const origin = environment.production ? 'https://philly-vanilly.github.io/init-auth' : 'http://localhost:4200'; | |
const configAuthZero: AuthConfig = { | |
issuer: 'https://philly-vanilly.auth0.com/', | |
customQueryParams: { audience: 'https://philly-vanilly.auth0.com/api/v2/' }, | |
redirectUri: `${origin}/index.html`, | |
silentRefreshRedirectUri: `${origin}/silent-refresh.html`, | |
clientId: 'r4gL1ntxR2lnodnu81WFnWNOWdO5SFuV', | |
scope: 'openid profile email', | |
clearHashAfterLogin: true, | |
showDebugInformation: true | |
}; | |
configAuthZero.logoutUrl = | |
`${configAuthZero.issuer}v2/logout?client_id=${configAuthZero.clientId}&returnTo=${encodeURIComponent(configAuthZero.redirectUri)}`; | |
@NgModule({ | |
imports: [OAuthModule.forRoot()], | |
providers: [ | |
InitialAuthService, | |
{ provide: AuthConfig, useValue: configAuthZero }, | |
{ | |
provide: APP_INITIALIZER, | |
useFactory: (initialAuthService: InitialAuthService) => () => initialAuthService.initAuth(), | |
deps: [InitialAuthService], | |
multi: true | |
}, | |
], | |
}) | |
export class AuthModule {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment