Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,153,412 members, 7,819,475 topics. Date: Monday, 06 May 2024 at 04:58 PM |
Nairaland Forum / Science/Technology / Programming / How Do Developers Handle Authentication? (389 Views)
How Do You Handle Authentication In Your Projects? What's The Industry Standard? / Why Do Developers Like Using Tiny Fonts / Why Do Developers Think Jquery Is Obsolete? (2) (3) (4)
How Do Developers Handle Authentication? by SqueezedPant: 1:38pm On Aug 08, 2023 |
I am currently making a file storage system for organizations as a side project , using next auth for the authentication(I don’t know how to roll my auth). Now the issue i am having is whenever i refresh the page , the session disappears for some seconds. Now this is where the problem is , as the session disappears , some routes are protected in the middleware.ts file. So immediately , the routes get locked. So how can i save session so that maybe if there is a 1 minute network blackout , i won’t get locked out immediately. I have ruled the idea of saving in local because if the network gets switched off completely , it would still be saved in there. And you cannot revalidate local storage based on “network timeout” . I would appreciate your help on this @qtguru please i would need your expert opinion here |
Re: How Do Developers Handle Authentication? by eazycash: 4:03pm On Aug 08, 2023 |
you didn't mention the technology your using to implement the authentication.how do you someone will be in the know how to be of help to you. |
Re: How Do Developers Handle Authentication? by SqueezedPant: 9:45pm On Aug 08, 2023 |
eazycash: NextAuth , Next Js 13 app directory |
Re: How Do Developers Handle Authentication? by potnovus(m): 10:00am On Aug 10, 2023 |
I'll try to give you general guidance here since this is an authentication problem, irrespective of technology used; also because I'm not necessarily a nextjs engineer. However, I'm aware that NextAuth uses JSON Web Tokens (JWTs) for managing user-sessions, with the option to persist session info in a database. Without knowing the specifics of your implementation and authentication needs, I can only advise that you pay attention to the expiration-time (Time To Live) set for the generated JWTs after you authenticate a user for the first time. When you increase the TTL of your tokens, you allow the user session to live a bit longer. That been said, if as part of your authentication flow, you maintain both a "refresh" and "access" token, then, you may have to decide which of the tokens' TTL you want to increase to satisfy the authentication need of your solution. I hope this helps. |
Re: How Do Developers Handle Authentication? by Deicide: 1:03am On Aug 13, 2023 |
NextAuth handles that automatically, check if maybe you not doing something correctly. |
(1) (Reply)
I Cn Open Lynda Premium Account 4 U 2 Learn New Skills Online & Get Certificate / Tutorials For New Developers? Blog Or Vlog? Which Will Get More Audience? / How To Create Custom Middleware In Redux
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 13 |