Hello, I have a tokenURI function in my smart contract like this:
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
string memory currentBaseURI = _baseURI();
return bytes(currentBaseURI).length > 0
? string(abi.encodePacked(currentBaseURI, tokenId.toString()))
: "";
}
I define a initBaseURI while deploying the contract, which is https://api.xxx.com/1 and this address returns the metadata as intended. The subdomain also has SSL. But when I try to validate this asset, I get the error below. It returns the error "Invalid response, expected 200 but got 403 for URL: (the api link)" but it works on another sites like reqbin.com when I try to test it and it can be reached.
How can I fix this issue?