Building a Wallet with Moralis APIs

Hello,

Iā€™m following Moralis tutorial on the Crypto Wallet Video on Youtube. You donā€™t show the very beginning of the application.

Once I add the URL and API on the main.js file and click on Open Live Server on VS Code, an empty page shows up in my browser with that pops up back and forth empty.

Please help!

Can you post your code please? What do you mean by pop up?

When I click on open live server, a white screen pops up in my browser. I donā€™t understand since I added the API and URL just like the tutorial says

Hi which video link is this from? Iā€™ve looked at it and thereā€™s a looping issue somewhere but thereā€™s already a lot of code in it. Did it work at all before? Or did you just copy everything?

That video. I didnā€™t add or change any line of code. The video just shows you the app right away but doesnā€™t show you how to run it correctly first at the beginning.

If you clone the repo for that tutorial and run it, it will give you the same results. The code in the repo is either missing something or there is a mistake if one of the html files Iā€™m guessing.

Thank you, youā€™re right it already has issues.

If you comment out the // REDIRECT USER BASED ON STATUS code in main.js you can get to the starting login page. Let me know if you get any further issues.

It works now, however, Iā€™m not able to sign in with my Metamask wallet even though my account is opened. I tried Rinkebym Ropsten and Mainnet networks.

Iā€™m just seeing the dashboard.html and index.html but not able to interact with them. Iā€™m going through the moralis docs. Canā€™t find a straight solution here to this problem

login = async () => {
await Moralis.Web3.authenticate()
.then(async function (user) {
let _username = document.getElementById(ā€˜user-usernameā€™).value;
let _email = document.getElementById(ā€˜user-emailā€™).value;
if(_username != ā€˜ā€™ || _email != ā€˜ā€™){
if(_username != ā€˜ā€™){user.set(ā€œnameā€, _username);}
if(_email != ā€˜ā€™){user.set(ā€œemailā€, _email);}
await user.save();
}
window.location.href = ā€œdashboard.htmlā€;
})
}

if (Moralis.User.current() != null && window.location.href == homepage) {
window.location.href = ā€œdashboard.htmlā€;
}

logout = async () => {
await Moralis.User.logOut();
window.location.href = ā€œindex.htmlā€;
}

Is the login function assigned to a button on click event? or you could try manually running the function to see if the function is loaded on the page.

Is your JS scripts added into these HTML pages?

Fixed it, it was just the javascript functions that I had to change now in the main.js

Thank you