Unauthorized and Forbidden error while submitting request to create a new pod

Hi, I have been working on developing solid apps for a while and i am being able to login using pod, read/write data to pod. Now i am trying to create a registration page in solid app which sends requests to solid server to provide the user with the pod. I went through few examples and instructions from:

Here is my index.html page

<!DOCTYPE html>

<html lang=“en”>

<head>

<meta charset=“UTF-8”>

<meta name=“viewport” content=“width=device-width, initial-scale=1.0”>

<meta http-equiv=“X-UA-Compatible” content=“ie=edge”>

<title>Document</title>

<script src=“https://solid.github.io/solid-auth-client/dist/solid-auth-client.bundle.js”></script>

<script type=“text/javascript” src=“app.js”></script>

</head>

<body>

<p>Hello</p>

Name:<br>

<input type=“text” name=“fname” id=“fname”>

<br>

Email:<br>

<input type=“text” name=“email” id=“email”>

<br>

Password:<br>

<input type=“text” name=“password” id=“password”>

<br>

<!-- <button id=“login” type=“button” onclick=“createAccount()”>Register</button> →

<button id=“login” type=“button” onclick=“createAccountNew()”>Register</button>

</body>

</html>

Here is my app.js file
async function createAccount() {
var account = document.getElementById(“fname”).value
var email = document.getElementById(“email”).value
var pass = document.getElementById(“password”).value

var url = createUrl(account)
var data = "username="+account+"&email="+email+"&password="+pass;
const request = {
    method: 'POST',
    headers: {
        slug: data,
        "Content-Type" : 'application/x-x509-user-cert'
    }
}

var created = await solid.auth.fetch(url, request)
                        .then(status => {
                            return status 
                        })
console.log('Printing status')
console.log(created);

}

async function createAccountNew() {
var account = document.getElementById(“fname”).value
var email = document.getElementById(“email”).value
var pass = document.getElementById(“password”).value

var url = createUrl(account)
var data = "username="+account+"&email="+email+"&password="+pass;
var http = new XMLHttpRequest();
http.open('PUT', url);
http.withCredentials = true;
http.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
http.onreadystatechange = function() {
    console.log('Printing ready State');
    console.log(this.readyState);
    console.log('-----------------');
    console.log('Printing status ');
    console.log(this.status);
    console.log('-----------------');
    console.log('Printing response text');
    console.log(this.responseText);
};
http.send(data);

}

function createUrl(account) {
return “https://”+account+".solid.community/"
}

I have used nodejs to host the application and every time i submit a request to create a new account i am getting the following errors:
When i use createAccount function i get 403 error and when i use createAccoutNew function i get 401 error.

Can somebody point me in the right direction to accomplish this registration.

Thank you

I have also passed /api/account/new in the url and the result is still the same 403 and 401