Questions tagged jwt

Explore the latest questions and answers asked by our top developers.

Intercept 401 error and prevent console error message

I’m using the following library axios-auth-refresh to automatically refresh the token. When I make a call to the API it returns a 401 error and in this way the library is triggered in order to execute the refresh token and ensure that all requests are successfully completed. I’m using axios to make API calls and […]

By Harry
Published
Categorized as angular, axios, javascript, jwt, typescript Tagged , , , ,

Interceptor – multi-request mechanism for the Refresh Token

Is there a way to make the axios.interceptors.request.use function synchronize so that each request is executed in an orderly way, that is, the second only executes at the end of the first? The objective is to intercept the requests and check if the token is valid or not. If the token is not valid or […]

By Harry
Published
Categorized as access-token, angular, axios, jwt, typescript Tagged , , , ,

Axios Interceptor – Synchronous multi-request mechanism for the Refresh Token

Is there a way to make the axios.interceptors.request.use function synchronize so that each request is executed in an orderly way, that is, the second only executes at the end of the first? The objective is to intercept the requests and check if the token is valid or not. If the token is not valid or […]

By Harry
Published
Categorized as access-token, angular, axios, jwt, typescript Tagged , , , ,

Angular HTTP interceptor not modifying HTTP request headers

I am working with Angular 13, attempting to add a JWT to headers to access a restricted route on the backend. JwtInterceptor does not appear to modify the HTTP request headers on the request per Chrome inspector’s network tab (under headers). I’ve only included HttpClientModule once in my project, in the root AppModule. I’ve appended […]

Angular Interceptor: headers added in the request not set properly, can’t fetch them from the API

I’m trying to add some custom headers in my angular interceptor as follow: @Injectable() export class HttpJwtAuthInterceptor implements HttpInterceptor { constructor() {} intercept(request: HttpRequest<unknown>, next: HttpHandler): Observable<HttpEvent<unknown>> { localStorage.setItem(‘token’, ‘qsdfqsdfqsdfqsdf’); if (localStorage.getItem(‘cuid’) && localStorage.getItem(‘token’)) { request = request.clone({ setHeaders: { ‘sm_universalid’:’blablabla’, Authorization: `Bearer ${localStorage.getItem(‘token’)}`, }, }); } return next.handle(request); } } The above interceptor was […]

API calls with JWT authentication returns 401

I have a .NET 6 Web API application that uses JWT authentication. The front end is an angular application. When I make an API call with the bearer token in the header, it returns the 401 error code. But with the same bearer token, I am able to call the same API from Swagger and […]

Refreshing JWT token – 401 error despite correctly attached token

Why does the second call return 401 despite the token having been refreshed correctly? It’s correctly attached to the second request(new refreshed token). I don’t understand this. Once refresh site cached token it works as expected. Why doesn’t it work in case of this interceptor refreshment of the JWT? public intercept( request: HttpRequest<any>, next: HttpHandler […]

By MSB MSB
Published
Categorized as angular, http, jwt, typescript Tagged , , ,

Steps to make a login page with Angular and Spring Boot

overflowers! Can someone tell me step by step how I can make an login page with Angular and Spring Boot? I tried to search on Google but all tutorials are very ambiguous. Source: AngularJS Questions

By Traian Simedru
Published
Categorized as angular, angularjs, authentication, jwt, spring Tagged , , , ,

Share main project token with admin (angular)

i have two angular projects: main project and admin i have login page in main project. when user login, jwt token generate for user and it’s save in localstorage. i want to share this token with admin project this.authService.Login().subscribe(res=>{ localstorage.setItem(‘token’, res.token); }); Source: Angular Questions

By KasraRS
Published
Categorized as angular, asp.net, authentication, jwt, token Tagged , , , ,

Generate JWT Token using client credentials flow in Angular app

I would like to generate jwt token in angular app without exposing the endpoint. As angular app is client side JavaScript framework, therefore endpoint that generates the token will be visible in the browser network. So my question is how can I generate jwt token in client side application? Can I use asp.net core web […]

By roczstar
Published
Categorized as angular, asp.net-core, c#, jwt, token Tagged , , , ,
1 2 3 23

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq