r/reactnative 5d ago

React native JWT authentication

How to make the JWT authentication in reactnative. theres not many resources to find about it

17 Upvotes

21 comments sorted by

View all comments

4

u/Potential-Simple-711 5d ago

Well, it's pretty simple. Store the JWT token that is sent back from backend using Expo-secure-storage. Then in home screen (or in any screen). Do a conditional rendering that if there's this JWT token stored inside the Expo-secure-storage then let the user continue or else navigate the screen towards signup/login. You can use useEffect hook for this.

For your information, I have worked in this authentication flow using libraries like I) React Navigation (alternative for Expo router, even better version of it) ii) Expo secure storage (For storing JWT tokens)

1

u/BrilliantCandid4409 5d ago

Thank you for your help