Skip to content

Commit

Permalink
Fix: fail to get jwt token (#14443)
Browse files Browse the repository at this point in the history
Co-authored-by: Huilong Shang <shanghuilong1026@sina.com>
  • Loading branch information
hwqllang authored Mar 30, 2021
1 parent 98cddda commit 7fe52b5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ import { ErrorComponent } from './layouts/error/error.component';
// Set this to true to enable service worker (PWA)
ServiceWorkerModule.register('ngsw-worker.js', { enabled: false }),
HttpClientModule,
NgxWebstorageModule.forRoot({ prefix: '<%= jhiPrefixDashed %>', separator: '-' }),
NgxWebstorageModule.forRoot({ prefix: '<%= jhiPrefixDashed %>', separator: '-', caseSensitive: true }),
<%_ if (enableTranslation) { _%>
TranslateModule.forRoot({
loader: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,11 @@
<%_ if (authenticationTypeJwt) { _%>
requestInterceptor: function (req) {
var authToken =
localStorage.getItem('<%= jhiPrefixDashed %>-authenticationtoken') || sessionStorage.getItem('<%= jhiPrefixDashed %>-authenticationToken');
localStorage.getItem('<%= jhiPrefixDashed %>-authenticationToken') || sessionStorage.getItem('<%= jhiPrefixDashed %>-authenticationToken');
if (authToken) {
<%_ if (clientFrameworkAngular || clientFrameworkReact) { _%>
authToken = JSON.parse(authToken);
<%_ } _%>
req.headers['Authorization'] = 'Bearer ' + authToken;
}
// Remove the sample Swagger UI request body if present
Expand Down

0 comments on commit 7fe52b5

Please sign in to comment.