Questions tagged [angular2-jwt]

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

97 questions
1
vote
0 answers

How to prevent Spring security login redirection 302 when request is sent by Angular 5

i always get 302 response instead of JSON response (200 OK), when i try to login using spring boot JWT, is there any plausible way to stop spring security from redirecting my http request after a successful authentication, btw i'm using angular 5…
Darwinos
  • 11
  • 3
1
vote
2 answers

Angular6 auth0/angular2-jwt isTokenExpired function always return false if we valid Token

I'm using auth0/angular2-jwt pakage for handling JWT Token Based authentication in Angular6 Application. if we gave valid token isTokenExpired function always returns false The below code i have tried: localStorage.setItem('id_token',…
Robert
  • 3,373
  • 1
  • 18
  • 34
1
vote
1 answer

Identifier 'authService' refers to a private member of the component

I really do not know where else is the problem. Service codes: import { Injectable } from '@angular/core'; @Injectable() export class AuthService { logout() { localStorage.removeItem('token'); } } Component codes: import { AuthService }…
1
vote
1 answer

How to pass secret key to backend(node js) from frontend(angular 4) using JWT

I am learning web application and just started with jwt authentication. I understand the general flow. How jwt tokens are created by backend and how frontend retrieves that passes in every subsequent requests . But in every online tutorial or…
user3651606
  • 107
  • 4
  • 9
1
vote
1 answer

Angular Detect 401 Unauthorized Access using JWT

I followed a couple of articles to implement JWT authentication on Angular and seems everything is working except detecting 401 unauthorized. I want to redirect the user to login page but I cannot detect the 401 error. I have this class: export…
Maihan Nijat
  • 9,054
  • 11
  • 62
  • 110
1
vote
0 answers

How to do a request using AuthHttp JWT Token in Angular 4 to a Spring Boot API mapped with @RequestPart?

I hava a Rest API developmented in Java using Spring boot. And it provides a resource mapped with @RequestPart that I receive an File and another content to pass to a service. Until now, all right. I can test in Postman no…
Igor Ramos
  • 251
  • 1
  • 2
  • 8
1
vote
1 answer

Angular 5 role based autherntication with @auth0/angular-jwt

i need for advice in role based auth with https://github.com/auth0/angular2-jwt/tree/v1.0 JWT Interceptor. How can i carry out "admin" role auth with Angular 5 ? Now i have: after login server send back jwt token with user id in payload and using…
Lucas
  • 71
  • 6
1
vote
1 answer

dotnet core 2.0 authentication from angular 5

I'm having problems hitting a controller action when I'm not [AllowAnonymous]. I can run the method perfectly from Postman, but not from my UI and I just can't see what's fundamentally different. I'm running the app on localhost:4200, but I've added…
Jerry
  • 25
  • 6
1
vote
0 answers

Angular2 Browser refresh not working with auth guard

I have searched the internet and could not find an answer. I found this post on the route guard not working on browser refresh, and the solutions did not work because I think it was Firebase-specific. app.module.ts @NgModule({ declarations: [ …
Prita Hasjim
  • 343
  • 1
  • 5
  • 15
1
vote
0 answers

Angular - Refresh JWT Token (parallel calls)

I have a question about the flow of refresh token. I try to make a call this the token. The token is expired and make a second request to refresh the token. I'm taking the response and rerun the request with the new token. Everything is perfect…
Michalis
  • 6,686
  • 13
  • 52
  • 78
1
vote
0 answers

jwt authentication in angular 4.0/webapi - null header when using http extender

i am trying to implement simple jwt authentication in angular 4 This is my server side web api authentication code public class BasicAuthMessageHandler : DelegatingHandler { private const string BasicAuthResponseHeader =…
Pein
  • 423
  • 3
  • 11
  • 27
1
vote
1 answer

angular 2 refresh token before custom http request

I want to refresh the token before the custom http request if it is expired. I try my code when I'm sure that the token is expired but it gives the following console result: Token refresh is required app.js:1:92855 updateToken() method inside …
Korki Korkig
  • 2,736
  • 9
  • 34
  • 51
1
vote
0 answers

Authorize attribute refusing requests for valid JwtSecurityToken

From this great tutorial I have been able to generate a token on the server and save it it local storage. https://stormpath.com/blog/token-authentication-asp-net-core But when sending the token to a controller method with an [Authorize] attribute I…
Richard Watts
  • 954
  • 2
  • 8
  • 21
1
vote
4 answers

Angular2 Spring Boot JWT missing Response Header

I use Angular2, Angular-cli, Spring Boot 1.4.0 and jwt. When I sign in my Angular2 client I can not get jwt token. My security config is: @Configuration @Order(SecurityProperties.ACCESS_OVERRIDE_ORDER) public class WebSecurityConfig extends…
renis
  • 171
  • 7
  • 16
1
vote
1 answer

Send http request before sending other http requests angular 2

I need to get jwt token via http module then make other requests with this token in header. How I can make delay of app initialization till token get request resolved?
Rakhat
  • 4,783
  • 4
  • 40
  • 50