Hi
After extensive searching in the forum, docs and the internet, I feel that I can post the question here. I am building a React Native application, which means I don't have access to localstorage (this is not a web-app) - I think that I need to save some kind of login token in my React native state variable and re-send it for every request (being my best guess). Other implementations I found on the forum uses web-implementations with Angular, but since this is not a web-page, I need to handle this using just JS.
I wonder if anyone here has experience of doing something similar? Is it possible to use a POST request using say axios to do something like this towards the login/register:
axios.post('myWeb2pyBackend/myapp/user', {
username: 'myloginname',
password: 'test2'
})
.then(function (response) {
console.log(response); // if OK, save some token to state and resend with every GET request later
})
.catch(function (error) {
console.log(error);
});
Observe that this is Node.js that doesn't have access to the browser window variable or any other browser specific thing like localstorage. Would it be possible to get a JSON web token as a response from web2py that I resend to the server when the user asks for other resources which requires a signed in user?
Cheers