---
title: "Gal Malachi (@galm) | Hashnode"
description: "Developer. Read the latest articles by Gal Malachi on Hashnode."
url: "https://hashnode.com/@galm"
---

@galm

# Gal Malachi

@galm · Tel Aviv, Israel · Joined August 2020

Developer

[Website](https://galmalachi.com/)

## Comments

[Hi Emmanuel Gruffy Absolutely, you can do that. You can also implement interceptors in your apiClient wrapper so you have a more robust method to handle the life cycle. But your suggested approach should definitely work](https://hashnode.com/posts/single-sign-on-jwt-authentication-and-react/5fe22997c65ad56bef3a30b4/comment/64e626b0cae237eabaaba617#reply-64e76f0dd47513fefda66d94)

Reply · Article · Aug 24, 2023 · [Single Sign-On, JWT Authentication, and React](https://hashnode.com/posts/single-sign-on-jwt-authentication-and-react/5fe22997c65ad56bef3a30b4)

[Thanks M. Suman Patra, I’ll try to publish it as soon as possible](https://hashnode.com/posts/single-sign-on-jwt-authentication-and-react/5fe22997c65ad56bef3a30b4/comment/5fe2d5c5e28a2b6bca52c3ca#reply-5fe3134cb4b79006ffdac0e7)

Reply · Article · Dec 23, 2020 · [Single Sign-On, JWT Authentication, and React](https://hashnode.com/posts/single-sign-on-jwt-authentication-and-react/5fe22997c65ad56bef3a30b4)

[Thank you, Braydon Coyer!](https://hashnode.com/posts/single-sign-on-jwt-authentication-and-react/5fe22997c65ad56bef3a30b4/comment/5fe255c5c65ad56bef3a330a#reply-5fe2579fe28a2b6bca52bea7)

Reply · Article · Dec 22, 2020 · [Single Sign-On, JWT Authentication, and React](https://hashnode.com/posts/single-sign-on-jwt-authentication-and-react/5fe22997c65ad56bef3a30b4)

[Thanks for mentioning me (:](https://hashnode.com/posts/must-read-developer-articles-on-hashnode-22/5fd786162444ad0ea8511ac3/comment/5fd7a4f67418a90e83c8961d)

Comment · Article · Dec 14, 2020 · [Must Read Developer Articles on Hashnode - #22](https://hashnode.com/posts/must-read-developer-articles-on-hashnode-22/5fd786162444ad0ea8511ac3)

[I’m not familiar with the packages/sdk you use (I assume you are the author, a disclaimer would’ve been nice btw) - so it might be easier, I’m not sure. But where’s the fun it that? I always prefer to have as much control as possible, if possible.](https://hashnode.com/posts/single-sign-on-jwt-authentication-and-nodejs/5fcfbe7e816f312818ff6edc/comment/5fd4d47eb6e5766805757dd3#reply-5fd4f52df60e3973bae6b475)

Reply · Article · Dec 12, 2020 · [Single Sign-On, JWT Authentication, and NodeJS](https://hashnode.com/posts/single-sign-on-jwt-authentication-and-nodejs/5fcfbe7e816f312818ff6edc)

[Great addition, thanks Martin Filteau, Eng., PMP 💪🏽](https://hashnode.com/posts/react-and-jwt-authentication-the-right-way/5f7332311d7a870a345b9db2/comment/5fad8694fa438d6532c7e735#reply-5fae3a27fa438d6532c7ed53)

Reply · Article · Nov 13, 2020 · [React & JWT Authentication - the right way!](https://hashnode.com/posts/react-and-jwt-authentication-the-right-way/5f7332311d7a870a345b9db2)

[Hi Eliran Shem Tov, Thanks for the feedback! Yes, it’s considered as a bad practice. You shouldn’t store the token in local/session storage. In part 2 of the series I deal with the client side, and provide code examples, I believe you’ll find some useful information there!](https://hashnode.com/posts/react-nodejs-and-jwt-authentication-the-right-way/5f4ff0aec48c6b29cd2ecd0a/comment/5f7b7beb9d088e603ef395b9#reply-5f7b81ef9d088e603ef395d9)

Reply · Article · Oct 5, 2020 · [React, NodeJS and JWT Authentication - the right way!](https://hashnode.com/posts/react-nodejs-and-jwt-authentication-the-right-way/5f4ff0aec48c6b29cd2ecd0a)

[I’m glad that you find it useful, Akash Raju M!](https://hashnode.com/posts/react-nodejs-and-jwt-authentication-the-right-way/5f4ff0aec48c6b29cd2ecd0a/comment/5f78abb69c3b6e4101216a5b#reply-5f78acb09c3b6e4101216a6d)

Reply · Article · Oct 3, 2020 · [React, NodeJS and JWT Authentication - the right way!](https://hashnode.com/posts/react-nodejs-and-jwt-authentication-the-right-way/5f4ff0aec48c6b29cd2ecd0a)

[Hi Lihai Ben-Haim, Glad you like it! Let me answer your questions: You are right, it is still not bulletproof, however, it makes it much difficult to still the token from the memory, as the attack should be tailored to your exact app. Combining that with a short-living tokens makes the risk low, but still exists. The limit come from the refresh token expiration. When the user is active and logged in, we don't want revoke his access. If we want to limit the time for an active user, we can add a logic on the client side or the backend to force logout after a certain period. I didn’t took care of it here, but it is completely possible. encrypting the token is a good practice as it contains the identifier of the user inside it, and if stolen can give the hacker data that might be used in future attacks.](https://hashnode.com/posts/react-nodejs-and-jwt-authentication-the-right-way/5f4ff0aec48c6b29cd2ecd0a/comment/5f7837917d160d41227d7363#reply-5f7841f47d160d41227d743c)

Reply · Article · Oct 3, 2020 · [React, NodeJS and JWT Authentication - the right way!](https://hashnode.com/posts/react-nodejs-and-jwt-authentication-the-right-way/5f4ff0aec48c6b29cd2ecd0a)

[rasd sounds like a complete solution! I thought about setting a retry logic, but I didn’t want to complicate stuff since this post is very long as is. However, I do believe that calling the refresh endpoint few seconds before the token expires should cover 99% of the cases.](https://hashnode.com/posts/react-and-jwt-authentication-the-right-way/5f7332311d7a870a345b9db2/comment/5f744280e46f1616184269a2#reply-5f74624d5defaf19d6aadb95)

Reply · Article · Sep 30, 2020 · [React & JWT Authentication - the right way!](https://hashnode.com/posts/react-and-jwt-authentication-the-right-way/5f7332311d7a870a345b9db2)
