I'm making ReactJS App powered by AWS Amplify framework.
I wanted to make custom signUp component. Everything works fine except that my localStorage is empty.
While I was using "withAuthenticator" method of authentication localStorage was full of data which was important for application to work, now its empty.
My question is: How to force aws amplify authentication to put authentication data into localstorage like it is doing in "withAuthenticator" method.
I include code of my signUp function.
Auth.signUp({
username,
password,
attributes: {
email,
phone_number
},
validationData: []
})
.then((data) => {
console.log(data);
})
.catch(err => console.log(err));
}
You can access the localStorage
to interact with it. It works as an essential key/value store, where the data stored never expires.
To write to it you use the localStorage.setItem()
method, providing the key and the value as its arguments.
You can later read the contents of a key by using the localStorage.getItem()
method.
Please check the entire interface documentation here:
https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage