How to use the angular2-jwt.AuthConfig function in angular2-jwt

To help you get started, we’ve selected a few angular2-jwt examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rucken / core / libs / web / src / shared / factories / auth-http.factory.ts View on Github external
static create(http: Http, options: RequestOptions) {
    const tokenGetter = () => localStorage.getItem('token');
    return new AuthHttp(new AuthConfig({
      headerName: 'Authorization',
      headerPrefix: 'JWT',
      tokenName: 'token',
      tokenGetter: tokenGetter,
      globalHeaders: [{ 'Content-Type': 'application/json' }],
      noJwtError: true,
      noTokenScheme: true
    }), http, options);
  }
}
github rucken / core / src / shared / factories / auth-http.factory.ts View on Github external
static create(http: Http, options: RequestOptions) {
    const tokenGetter = () => localStorage.getItem('token');
    return new AuthHttp(new AuthConfig({
      headerName: 'Authorization',
      headerPrefix: 'JWT',
      tokenName: 'token',
      tokenGetter: tokenGetter,
      globalHeaders: [{ 'Content-Type': 'application/json' }],
      noJwtError: true,
      noTokenScheme: true
    }), http, options);
  }
}
github Crunchy-Torch / coddy / front / src / app / auth / auth-http.service.ts View on Github external
constructor(http: Http, defOpts?: RequestOptions) {
    super(new AuthConfig({
      noTokenScheme: true,
      tokenName: Token.TOKEN_KEY,
      globalHeaders: [ {'Content-Type': 'application/json'} ],
      noJwtError: true
    }), http, defOpts);
  }
}
github bulktrade / SMSC / modules / admin / src / app / common / index.ts View on Github external
useFactory: (http: Http, tokenService: TokenService) => {
            let config: AuthConfig = new AuthConfig({
                headerName: 'Authorization',
                headerPrefix: 'Bearer',
                tokenName: AUTH_TOKEN_NAME,
                tokenGetter: () => {
                    return new Promise((resolve) => {
                        resolve(tokenService.getToken());
                    });
                },
                noJwtError: true,
                noTokenScheme: true,
                globalHeaders: [{'Content-Type': 'application/json'}]
            });

            return new AuthHttp(config, http);
        },
        deps: [Http, TokenService]

angular2-jwt

Helper library for handling JWTs in Angular 2+

MIT
Latest version published 8 years ago

Package Health Score

61 / 100
Full package analysis