'React Native: How to remove token with AsyncStorage with JWT ?
I am currently storing my React Native token like so using var jwt = require('jsonwebtoken');
:
AsyncStorage.setItem('token', response.token)
And I'm not sure if this is the correct way for React Native to check if the token is stored, but in the Chrome browser's Developer Tools, under Application and then Storage's Cookies, it shows a token and its value.
Then in order to remove the token, I do the following:
AsyncStorage.removeItem('token')
yet even if I refresh the Storage's Cookies' page, the token still shows.
Is it being removed but am I viewing the token incorrectly or is it not being removed at all? If so what am I doing wrong?
Thank you in advance
Solution 1:[1]
Just use AsyncStorage.removeItem('token'). It worked for me.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Arunkumar K |