我在 react-native 中使用异步存储保存了令牌。有什么办法可以在 Node.js 后端获取这个令牌值吗?
答案 0 :(得分:0)
根据https://reactnative.dev/docs/asyncstorage,您可以从存储中获取该项目。您必须将其发布到后端可能使用 fetch
fetch('https://example.com/uploadtoken', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(TOKEN),
}).then(response => response.json()).then(data => {
console.log('Success:', data);
}).catch((error) => {
console.error('Error:', error);
});