Thanks for checking that cryptokid. How do you authenticate a user that is signing in? Here is the code I am using to log the user in.
script>
//connect to Moralis server
Moralis.initialize("lRCkcYjDbFtpxYwnA4un13UtUi7RqBfVtyjx5g0n"); // Application id from moralis.io
Moralis.serverURL = "https://kprjvwm59njt.moralisweb3.com:2053/server"; //Server url from moralis.io
//Display login button and let user login
async function login(){
console.log("login clicked");
var user = await Moralis.Web3.authenticate(); //wait for user to authenticate
if(user){
console.log(user); //print user to console
}
// get NFTs for current user on Mainnet
async function getNFTs(){
// const options = { chain: 'eth', address: 'ethereum.selectedAddress' };
const nfts = await Moralis.Web3API.account.getNFTs();
console.log(nfts)
nfts.forEach(function(nfts){
let url = fixURL(nft.token_uri);
fetch(url)
.then(response => response.json())
.then(data => {
$("content").html($("content").html()+"<h2>"+data.name+"/h2");
$("content").html($("content").html()+"<h3>"+data.description+"</h3>");
$("#content").html($("#content").html()+"<img src='"+fixURL2(data.image)+"'></img>");
});
})
}
function fixURL(url){
if(url.startsWith("ipfs")){
return "https://ipfs.moralis.io:2053/ipfs/"+url.split("ipfs://ipfs/").slice(-1)[0];
}
else{
return url+"?format=json"
}
}
}
getNFTs()