Questions about helper library for working with JWTs in your Angular 2 applications
Questions tagged [angular2-jwt]
97 questions
22
votes
5 answers
How to send JWT token as authorization header in angular 6
Currently I used this static code in component .ts file but this one is not work. It returns unauthorized(401). But when I pass token as query string it works fine. Please give a working example for component .ts file.
import { HttpClient,…

Sumit
- 1,702
- 2
- 14
- 20
16
votes
5 answers
Angular2 - How to best handle expired authentication token?
I am using Angular 2.1.2.
I have an authentication token (using angular2-jwt) and if it expires my webApi call fails with a 401 error. I am looking for a solution where the user will not lose any input data.
I can catch this 401 and open a modal…

Don Chambers
- 3,798
- 9
- 33
- 74
11
votes
4 answers
angular2-jwt No provider for AuthConfig
I am struggling with the angular2-jwt documentation for rc5
Here is my NgModule
import { AuthHttp } from 'angular2-jwt';
@NgModule({
imports: [ BrowserModule,
routing,
HttpModule,
FormsModule,
…

Tampa
- 75,446
- 119
- 278
- 425
7
votes
3 answers
How to avoid/fix "Auth0Lock is not defined" exception
I am trying to use the Auth0 for social login but I keep getting an exception of an undefined reference.
This is the authentication service
import { Injectable } from '@angular/core';
import { tokenNotExpired } from 'angular2-jwt';
// Avoid…

Siya Mzam
- 4,655
- 1
- 26
- 44
6
votes
1 answer
No Provider for AuthHttp! Angular2-Jwt provider issue
At least I thought I was providing correctly. Below are the relevant snippets of my app.module file and the service in which I use AuthHttp. I followed the configuration in the ReadMe for creating the factory method to provide for AuthHttp, but…

ruhrohraggy
- 89
- 3
4
votes
2 answers
Angular 6 using angular2-jwt
After the migration of my app from Angular 4^ to Angular 6 (newest version) I got a very weird error in my Auth service.
Specific, the angular2-jwt package is causing a killer error when I try to "serve" or "build" the app in production environment.…

Paulo H. Tokarski Glinski
- 384
- 1
- 4
- 15
4
votes
1 answer
Rails 5.1: devise_token_auth returns 2 errors when only 1 should be found
Similar to this question for the regular devise gem, using devise_token_auth gem is showing the same result - validation errors appearing twice in the json response!?
From log:
Processing by DeviseTokenAuth::RegistrationsController#create as JSON
…

rmcsharry
- 5,363
- 6
- 65
- 108
3
votes
1 answer
Call .NET CORE Web API Secure End-point from Angular by passing Azure B2C JWT Bearer token
I need to call secure Web API from Angular 9 application by presenting the Azure B2C JWT Bearer token. I am using Angular 9 with .NET CORE 3.1 Web API. I have managed to generate Azure B2C token but stuck to call secure Web API end-point as I am…

K.Z
- 5,201
- 25
- 104
- 240
3
votes
1 answer
AuthHttp in Angular 6 (Migration from Angular2 to Angular6)
I've recently migrated my application from Angular2 to Angular6
My build failed because of Angular2-JWT so I upgraded it to @auth0/angular-jwt
Now I'm stuck while updating my code as AuthHTTP and AuthConfig are deprecated.
I have a factory.ts for my…

Joseph Vinodh
- 31
- 3
3
votes
2 answers
isTokenExpired method returns true and false
I'm quite new at angular and I'm trying to verify my authentication token by using angular-jwt on Angular 6.The purpose of verifying the token would be to allow different buttons when the user logs and show a different set of buttons when they log…

Randika Peiris
- 147
- 1
- 2
- 10
3
votes
2 answers
.Net Core 2 JWT, Angular 2 Authorization through roles does not work
I have the following useful load in a token generated with JWT
{
"sub": "flamelsoft@gmail.com",
"jti": "0bca1034-f3ce-4f72-bd91-65c1a61924c4",
"http://schemas.microsoft.com/ws/2008/06/identity/claims/role": "Administrator",
"exp":…

Team Flamelsoft
- 43
- 1
- 7
3
votes
3 answers
Angular - JWT Refresh Token
After a long time I didn't find an approach about refresing tokens
TTL: 30 minutes
Refresh TTL: 2 Weeks
If I refresh the page after 45 minutes innactive then I make a getAccessToken() function to send the expired token and then send me back a…

Michalis
- 6,686
- 13
- 52
- 78
3
votes
1 answer
No provider for AuthHttp! on angular2-jwt
im really new on Angular 2 and i want to use JWT on my project. So i follow the instructions exactly where a give from the official page of angular2-jwt using the basic configuration.
I create a file named auth.module.ts with the following…

Ali Briceño
- 1,096
- 2
- 17
- 44
3
votes
1 answer
unit testing a component which is injected by a service which is using angular2-jwt AuthHttp call instead of http call
I have been using HTTP to call API to do my stuff, later introduced angular2-jwt to intercept the http calls and pass the jwt tockens. Unit testing was working fine until AuthHttp was used. I have created 'mockuserdata' model to return the mock…

Baji Jabbar
- 167
- 1
- 10
3
votes
1 answer
Asp.Net core identity with angular2
I've created a web-app used Asp.Net with angular2. I've used a generator-aspnetcore-spa and now I would like to add identity.
I think about I can use Asp.Net Identity and use a SQL Server database to store user names, passwords, and profile data.
I…

mskuratowski
- 4,014
- 15
- 58
- 109