I am working with PHP and JavaScript. I integrated metamask with PHP, so for this I am using "Ajax", but I want to know that how we can use "jwt token" (create) if we successfully connected with Metamask?
Here is my current code
<script>
const ethereumButton = document.querySelector('.enableEthereumButton');
const showAccount = document.querySelector('.showAccount');
ethereumButton.addEventListener('click', () => {
getAccount();
});
async function getAccount() {
const accounts = await ethereum.request({ method: 'eth_requestAccounts' });
const account = accounts[0];
$('#cst_account_var').val(account);
var bla = $('#cst_account_var').val();
$.ajax({
type: "POST",
url: "<?php echo base_url(); ?>/admin/add_wallet",
data: {wallet: bla},
dataType: "text",
cache:false,
success:
function(data){
window.location.replace("<?php echo base_url(); ?>profile");
}
});
}
</script>