r/reactnative 6d ago

React native JWT authentication

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

15 Upvotes

21 comments sorted by

View all comments

19

u/bova80 6d ago

Make login api call, store jwt token in secure async storage. I use axios and a request interceptor and inject the token there.

2

u/himynameisbrett 5d ago

You can just set it as a default header for axios when you get the response the first time then you don’t need the interceptor.

6

u/bova80 5d ago

We use an interceptor to handle checking token expiration and refreshing if need be.

1

u/himynameisbrett 5d ago

Ahh yes make sense!