Questions tagged [angular2-jwt]

Questions about helper library for working with JWTs in your Angular 2 applications

97 questions
3
votes
0 answers

How to handle JWT expiration in Angular2?

I use slim-jwt-auth on the server side. I don't find a good way to handle token expiration in angular. My current strategy: I use a canActivate guard to check the token before accessing a route. Check mean: - check if token is valid (server) -…
robert
  • 797
  • 3
  • 9
  • 23
3
votes
1 answer

Angular2-jwt - AuthHttp, refresh tokens, putting it all together

It kind of seems like I am going in circles here, and perhaps it's because of the use of so many subscriptions and having to chain them together. I want to be able to refresh a token if it's expired using the refresh token. Here is what I have, and…
blgrnboy
  • 4,877
  • 10
  • 43
  • 94
3
votes
1 answer

angular2-jwt : useFactory directive being ignored

I'm struggling to integrate the angular2-jwt package. I've written the following function with custom configuration options import { Http, Headers, RequestOptions } from '@angular/http'; import { provideAuth, AuthHttp, AuthConfig } from…
prime
  • 2,004
  • 3
  • 28
  • 45
3
votes
4 answers

angular2 2.0.0 UNMET PEER DEPENDENCY rxjs@5.0.0-beta.12, npm WARN angular2-jwt@0.1.22 requires a peer of rxjs@5.0.0-beta.11

this is dependencies from my package.json file: "dependencies": { "@angular/common": "2.0.0", "@angular/compiler": "2.0.0", "@angular/core": "2.0.0", "@angular/forms": "2.0.0", "@angular/http": "2.0.0", …
user1838078
  • 31
  • 1
  • 2
2
votes
1 answer

Getting 403 error when refresh the page of my Angular 6 project

I have an Angular 6 project with JWT authorization deployed in AWS Elastic Beanstalk and using CloudFront, which I manage with @auth0/angular-jwt library. Everything works fine, I have a link to my page which append an authorization token to the…
Alavaros
  • 1,665
  • 7
  • 32
  • 52
2
votes
3 answers

Angular6 angular-jwt not adding token to request headers

am using angular-jwt to intercept my requests and add the JWT token, but that doesn't seem to be happening. This is my angular info: Angular CLI: 6.0.8 Node: 9.11.2 OS: linux x64 Angular: 6.0.6 ... animations, common, compiler, compiler-cli, core,…
Rodgers Ouma
  • 103
  • 2
  • 13
2
votes
2 answers

Getting error in Jwthelperservice

I am pretty new to angular, I fetched code : url = https://github.com/DavideViolante/Angular-Full-Stack import { Injectable } from '@angular/core'; import { Router } from '@angular/router'; import { JwtHelperService } from…
Anil Kumar
  • 209
  • 1
  • 4
  • 15
2
votes
1 answer

Auth0 Angular parseHash returns undefined

I am using auth0-jwt to handle authentication: this.auth0.parseHash((err, authResult) => { if (authResult && authResult.accessToken && authResult.idToken) { window.location.hash = ''; this.setSession(authResult); …
Yuvals
  • 3,094
  • 5
  • 32
  • 60
2
votes
1 answer

Generic http error handling in Angular

angular2-jwt provides an AuthHttp wrapper for the native Angular http class that automatically includes the http authorization header with each request. In my services I am usually calling a backend api like this getThings(): Observable
Devin Crossman
  • 7,454
  • 11
  • 64
  • 102
2
votes
3 answers

Angular 2 JWT x-access-token

I'm having a problem setting my JWT in the header for my requests. Here's how I'm building the request: const headers = { 'x-access-token' : this.token }; const config = { headers: headers }; return this.http.get(this.allStudentsUrl, config) …
CaseyB
  • 24,780
  • 14
  • 77
  • 112
2
votes
0 answers

JWT - canActivate:[AuthGuard] not allowing login

I am creating a sample MEAN authentication app, in which i have a home page, register page, login page, dashboard and profile page. I am trying to apply authentication with the help of angular2-jwt. But it is not working for me. I am stuck at login…
Dheeraj Kumar
  • 102
  • 12
2
votes
0 answers

auth0 getUserInfo app_metadata issue

I'm a beginner with auth0 and Angular 2. I'm trying to use Auth0 to authentication and authorization on my app. Below the code I use to initialize the authentication @Injectable() export class Auth { //Configure Auth0 lock = new…
2
votes
1 answer

Call laravel backend api from angular 2

I am developing a website fronted in angular2 and an api in laravel with dingo. Now I want to get the data from this api in angular 2. But of course I want to protect the api so that for now only my angular frontend is allowed to get a response from…
maesk
  • 233
  • 1
  • 4
  • 11
1
vote
0 answers

Exporting a node module with a component library in Angular?

I made a component library using the Angular CLI and I have have a separate test application that imports this library. The component library builds nicely, but I am having trouble running "ng serve" in the test application because one of the…
ACarr
  • 89
  • 6
1
vote
1 answer

Cannot includ/send jwt token using auth0/angular-jwt

I use "https://github.com/auth0/angular2-jwt" to send JWT token to my server, I can see the token when I debug http request (angular) but at the server (java) the token is not found this is my config jwt JwtModule.forRoot({ config: { …
Ahmed
  • 11
  • 3