iayti / CleanArchitecture

ASP.NET Core 6 Web API Clean Architecture Solution Template
MIT License
654 stars 120 forks source link

Occasionally receive 401 (Unauthorized) #49

Open byteloser opened 1 year ago

byteloser commented 1 year ago

I occasionally receive the error 401 (Unauthorized) after login. I am then required to restart the application pool and it will work fine again for a few days or sometimes weeks.

Not a big application or complicated app by any means (< 10 users and not much more complicated than the todo sample code). Memory usage is below 200 MB.

I am fairly new to Web API, Angular, and IdentiyServer programming so I assume the problem is something I am doing wrong.

Any ideas on where to look are highly appreciated.

iayti commented 1 year ago

The default JWT token period within the theme is 90 days. If you have changed this period, the token may be expiring.

The problem seems likely to be token related.

byteloser commented 1 year ago

Would you mind me asking where I can change the setting? I think I did, but can't remember where or how.

Thanks and sorry for this most likely stupid question.

iayti commented 1 year ago

You can take a look at the TokenService class.

No problem. Have a nice coding :)

image

byteloser commented 1 year ago

Thank you! It couldn't be more obvious and still, I couldn't find it. Feeling slightly embarrassed now.

iayti commented 1 year ago

You can search for the "TokenService" class in the IDE (Visual Studio or VS Code etc.).

byteloser commented 1 year ago

I found it, sorry for the miscommunication. What I meant to say is that it is so logical where to look, I should have figured it out without asking. Thanks again for your help!

iayti commented 1 year ago

you are welcome :)