I have these thoughts about auth tokens in web app. Instead of keeping the token in local storage, what do you think about the following: - Add interceptor to your auth request that sets the token as cookie (you can set this strictly to your app domain or to your host if you have several apps on different sub domains but can use same token) - Add another interceptor that would get token from cookie and sets same to either header or as bearer token (depending on what your backend supports) for every outgoing authenticated request. - Instead of worrying about clearing token from storage, you can set cookie to expire after a time period.
Ndubuisi Samuel’s Post
More Relevant Posts
-
Step-by-Step API Integration Made Simple! APIs are the bridge that connects your app to the world. Here's how to get started: 1️⃣ Understand the API documentation. 2️⃣ Set up authentication (API keys, tokens). 3️⃣ Send requests and handle responses. 4️⃣ Test thoroughly to ensure smooth functionality. API integration doesn’t have to be complicated—let’s break it down and make it seamless for your app! 💡 Ready to learn more? Explore our detailed guide here: https://lnkd.in/eZk54cGZ #APIIntegration #DevelopersGuide #CodingMadeSimple #ScrumDojo #LearnAndBuild
To view or add a comment, sign in
-
Technical question for my network. I have a NextJS14 app, app router. The app has a gallery. The gallery page is server-rendered. I make an API call in a server action from the page for images from my DB. It gets the images, a few hundred and passes them down to the gallery client component. Now, I added this knowing it was not very efficient but at the time I just needed something working. I am looking to rebuild it. The question is, what approach is best to improve how well it works? Do I stick with how it is but build in pagination so we load 20 - 30 images at a time? Or do I still grab all the images, so the user can just keep scrolling and in some sort of lazy load? The gallery client component shows all the images on styled cards. They can be liked, which is about the maximum amount of functionality right now. Interested in thoughts and approaches as the images themselves will continue to grow into the hundreds and thousands.
To view or add a comment, sign in
-
Build awesome booking experiences without code. Configurable in hours... really! Pretty straightforward build with a little guidance. Feel free to schedule time here if you are interested in learning more: https://lnkd.in/eHXTJSdZ Leverages some great configurable capabilities including: - Reactivity - great new flow feature rolled out in 2023 - Data Fetcher - free app on app exchange https://lnkd.in/eX9SPGte - DateMaster - inexpensive app on app exchange... about the cost of a single user license https://lnkd.in/eEDAGd5p
To view or add a comment, sign in
-
Build awesome booking experiences without code. Configurable in hours... really! Pretty straightforward build with a little guidance. Feel free to schedule time here if you are interested in learning more: https://lnkd.in/eHXTJSdZ Leverages some great configurable capabilities including: - Reactivity - great new flow feature rolled out in 2023 - Data Fetcher - free app on app exchange https://lnkd.in/eX9SPGte - DateMaster - inexpensive app on app exchange... about the cost of a single user license https://lnkd.in/eEDAGd5p
To view or add a comment, sign in
-
HOW ARE YOU HANDLING YOUR API REQUESTS ?? So, For a large production scale web app, How do you manage your API Calls efficiently? - Do you use fetch and create some custom hook? - Do you use Axios simply? - Or is there any other way you tackle this. Here is what I have been doing and I don't know If this is the most efficient solution: 1. I have created an axios Client uisng the create function of axios instance. 2. Added Request Interceptors to add Authorization Token. 3. Added Response Interceptors for Error Handling. How are you doing it? I'd love to know.
To view or add a comment, sign in
-
I just added email to my #nextjs app, SamplePal with Resend. Holy crap it was easy! This is the most seamless, best documented API I've seen a long time. I highly recommend them if you need to add an email service to your app. One awesome thing about their API docs is the examples have your API key and email address already in there. This was the easiest copy/paste I've ever seen. Well done Resend https://lnkd.in/ekcRdydt
To view or add a comment, sign in
-
Build awesome booking experiences without code. Configurable in hours... really! Pretty straightforward build with a little guidance. Feel free to schedule time here if you are interested in learning more: https://lnkd.in/eHXTJSdZ Leverages some great configurable capabilities including: - Reactivity - great new flow feature rolled out in 2023 - Data Fetcher - free app on app exchange https://lnkd.in/eX9SPGte - DateMaster - inexpensive app on app exchange... about the cost of a single user license https://lnkd.in/eEDAGd5p
To view or add a comment, sign in
-
Build awesome booking experiences without code. Configurable in hours... really! Pretty straightforward build with a little guidance. Feel free to schedule time here if you are interested in learning more: https://lnkd.in/eHXTJSdZ Leverages some great configurable capabilities including: - Reactivity - great new flow feature rolled out in 2023 - Data Fetcher - free app on app exchange https://lnkd.in/eX9SPGte - DateMaster - inexpensive app on app exchange... about the cost of a single user license https://lnkd.in/eEDAGd5p
To view or add a comment, sign in
-
Build awesome booking experiences without code. Configurable in hours... really! Pretty straightforward build with a little guidance. Feel free to schedule time here if you are interested in learning more: https://lnkd.in/eHXTJSdZ Leverages some great configurable capabilities including: - Reactivity - great new flow feature rolled out in 2023 - Data Fetcher - free app on app exchange https://lnkd.in/eX9SPGte - DateMaster - inexpensive app on app exchange... about the cost of a single user license https://lnkd.in/eEDAGd5p
To view or add a comment, sign in
-
Build awesome booking experiences without code. Configurable in hours... really! Pretty straightforward build with a little guidance. Feel free to schedule time here if you are interested in learning more: https://lnkd.in/eHXTJSdZ Leverages some great configurable capabilities including: - Reactivity - great new flow feature rolled out in 2023 - Data Fetcher - free app on app exchange https://lnkd.in/eX9SPGte - DateMaster - inexpensive app on app exchange... about the cost of a single user license https://lnkd.in/eEDAGd5p
To view or add a comment, sign in
Software Engineer
8moThis is exactly how I do it nowadays. Easier than localStorage. Especially now the web JavaScript frameworks are embracing SSR. It’s impossible to share Auth tokens using just localStorage.