How to use angular2-jwt - 10 common examples

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 unfetter-discover / unfetter-ui / src / app / core / services / auth.service.ts View on Github external
public loggedIn(): boolean {
        if (this.runMode === 'DEMO') {
            return true;
        } else {
            let tokenExpired: boolean = true;
            try {
                tokenExpired = tokenNotExpired('unfetterUiToken');
            } catch (e) { }
            return tokenExpired && this.getUser() !== null && this.getUser().approved === true && !this.getUser().locked;
        }
    }
github OmicsDI / ddi-web-app / web / src / app / services / auth.service.ts View on Github external
loggedIn() {
    let result: boolean;
    result = tokenNotExpired("id_token");
    if(!result){
      return false;
    }
    return result;
  }
}
github efstathiosntonas / ngx-form / src / app / auth / auth.service.ts View on Github external
isLoggedIn() {
    if (!tokenNotExpired()) {
      localStorage.clear();
    }
    return tokenNotExpired();
  }
}
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);
  }
}

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