【发布时间】:2017-08-27 18:13:06
【问题描述】:
尝试更新 angular2 与 cli 一起完全是一场灾难。我试图恢复但不能关于 angular2-cli。现在我的应用程序将无法加载,因为带有 auth0 的 JWT。它曾经工作过。错误如下。
209:29 is this line:
tokenGetter: (() => localStorage.getItem('id_token')),
但它曾经可以工作,并且它是 auth0 文档的一部分: https://github.com/auth0/angular2-jwt#basic-configuration
'ERROR in Error encountered resolving symbol values statically. Function calls are not supported. Consider replacing the function or lambda with a reference to an exported function (position 209:29 in the original .ts file), resolving symbol AppModule in /Users/angular2cliisstupid/Documents/frontend/qta/src/app/app.module.ts`
provideAuth({
headerName: 'Authorization',
headerPrefix: 'bearer',
tokenName: 'token',
tokenGetter: (() => localStorage.getItem('id_token')),
globalHeaders: [{ 'Content-Type': 'application/json' }],
noJwtError: true
})
【问题讨论】:
-
你为什么不写
localStorage.getItem('id_token')?