Тёмный

Angular Authentication part - 2 (Handling refresh token + Http Interceptor + .NET Core API) #28 

Nihira Techiees
Подписаться 21 тыс.
Просмотров 21 тыс.
50% 1

Опубликовано:

 

29 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 31   
@beautysingh2415
@beautysingh2415 2 года назад
Very nice and helpful can you explain how to handle cors error in production
@NihiraTechiees
@NihiraTechiees 2 года назад
Will upload soon
@sushilAmbedkarwadi
@sushilAmbedkarwadi 9 месяцев назад
Based on your code user cannot logout untill he hit logout button right ..but if we want when user actively working in this case I need refresh token if user not working and token expired then I need he should logout and relogin ...please suggest me
@NihiraTechiees
@NihiraTechiees 9 месяцев назад
In interceptor i added calling refresh token logic... Then you can directly do log out also you can give some alert like current session expired
@sushilAmbedkarwadi
@sushilAmbedkarwadi 9 месяцев назад
@@NihiraTechiees thank you sir
@janoshollosi9570
@janoshollosi9570 11 месяцев назад
I had issues with token data and changed the property names at Savetoken function jwtToken to JWTToken, and refreshToken to RefreshToken. jwtToken and refreshToken were undefined.
@NihiraTechiees
@NihiraTechiees 11 месяцев назад
It's case sensitive so check what response you received from api.... Change it accordingly
@techbuzz3869
@techbuzz3869 2 года назад
im getting list data by using intercepotrs refresh token method,(after expiration the data is getting) in console, it showing the request is error with 401 status. why it is giving in console, when it is working . is it a bug ??
@NihiraTechiees
@NihiraTechiees 2 года назад
Did you missed any step. Please verify it
@PlusFlo
@PlusFlo 2 года назад
Hello! Thx for this great example! But.... if you wanna receive the refresh token and the server response 401, too (is expired, too as example) nothing happened. The Interceptor hangs and the error will not be handled.
@NihiraTechiees
@NihiraTechiees 2 года назад
For error handling follow this video ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-aiknsMjF1n0.html
@techbuzz3869
@techbuzz3869 2 года назад
cant we avoid printing the 401 unauthroized in console, we are calling handlerefreshing token it is working good, but when the token is expired it will check status 401 and call refresh method. when token is expired, it is showing 401 in console
@NihiraTechiees
@NihiraTechiees 2 года назад
Please share the code snippets to my mail
@WilbertQuijano
@WilbertQuijano Год назад
Same here, if you can share the solution please
@WilbertQuijano
@WilbertQuijano Год назад
is it normal that in developers tool, you will see 401 error, even you have intercepted 401?
@NihiraTechiees
@NihiraTechiees Год назад
May be previous exception not cleared
@WilbertQuijano
@WilbertQuijano Год назад
Can you show in the video the dev tools is not logging any 401 in console? Tyia
@EREN11997
@EREN11997 2 года назад
What is the use of switchMap()?
@NihiraTechiees
@NihiraTechiees 2 года назад
Switchmap is one of rxjs operators for access observable inside the observanle for more details refer this link ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-FVgaacYNoy0.html
@raulrothschild
@raulrothschild 2 года назад
In getting Circular dependency in DI error ):
@NihiraTechiees
@NihiraTechiees 2 года назад
1,Can you share the error message? 2, when you are facing issue while running (or) after deployment? 3,Possible reason when 2 services depending on each other then this will show error. Solving this error need to create separate service
@adekolaolawale3543
@adekolaolawale3543 3 месяца назад
This guy really needs to work on his accent and explanation, he is really bad explaining concepts in a comprehensible manner
@NihiraTechiees
@NihiraTechiees 3 месяца назад
I happy to have freelancer like you for doing free quality check....good job brother 👍
@kevincordell9539
@kevincordell9539 Год назад
Hello, I copied your code as you have it and I am using Angular 14. On the refresh I am receiving this error: pipe is not a function at this line of code: return authservice.GenerateRefreshToken().pipe(. Did something change between Angular 13 and 14? Here is my code: handleRefrehToken(request: HttpRequest, next: HttpHandler) { let authRequest = request; return this.authService.GetRefreshToken().pipe( switchMap((data: any) => { this.authService.SaveTokens(data); //authRequest = this.AddTokenheader(request); return next.handle(this.AddTokenheader(request)); }), catchError(errordata =>{ console.log('logout') this.store.dispatch(logoutAction()); return throwError(()=>errordata); }) ); I have Angular version 14.2.3 and "typescript": "~4.8.3" thank you
@NihiraTechiees
@NihiraTechiees Год назад
Pipe is a operator from rxjs. Please check do you have the package
@kevincordell9539
@kevincordell9539 Год назад
@@NihiraTechiees "rxjs": "~7.4.0",
@NihiraTechiees
@NihiraTechiees Год назад
Please send me the file to my email
@34muhammadawais40
@34muhammadawais40 Год назад
please send me full code of interceptor
@NihiraTechiees
@NihiraTechiees Год назад
Check in description
Далее
Brawl Stars expliquez ça
00:11
Просмотров 7 млн
Stay Fresh: .NET 7 Web API Refresh Tokens 🌊
18:25
Просмотров 20 тыс.
Angular Login using Access & Refresh Tokens
22:44
Просмотров 27 тыс.
Refresh Tokens en Angular 18 usando interceptors
20:18
Просмотров 3,8 тыс.
JWT Refresh Token in ASP.Net Core (a deep dive)
33:13
Refresh Tokens with a .NET 6 Web API 🚀
25:42
Просмотров 47 тыс.