How can i get the email of the logged in user

Hello ,Everyone .
I am new to Jira Apps development ,I am developing Jira app using atlas-connect In my app i get the Jira Issue Id from the User and display the description in the app.
Now the credentials are hard-coded in the credentials.json file which includes email and the auth token .
If I publish it to the market place how can i update the email and auth-token to the respective user who have installed it ,Is there any way
Any leads is highly appreciated
Here is my code :

{{!< layout}} <script src="https://connect-cdn.atl-paas.net/all.js">
  </script>
  <script>
    var authToken = "";
    var baseUrl = "https://plugin.atlassian.net/";
    var issueid = "";
    var emailaddress = "niha@tutuapp.bid";
    function extractBaseUrl(url) {
      const urlObject = new URL(url);
      const baseUrl = urlObject.origin;
      return baseUrl;
    }


    function getIssue() {
      console.log("before getting the value of url")
      console.log(baseUrl);
      issueid = document.getElementById("issueKey").value;
      console.log(issueid);
      document.getElementById("issueSummary").value = "";
      authToken = document.getElementById("AuthToken").value;
      console.log(authToken);
      console.log("dont make changes above than this")
      AP.request('/rest/api/3/issue/' + document.getElementById("issueKey").value, {
        success: function (response) {
          var obj = JSON.parse(response);
          var issueSummary = obj.fields.description.content[0].content[0].text;
          document.getElementById("issueSummary").value = issueSummary;
          var pageTitle = location.origin;
          console.log("page Title :", pageTitle);
          AP.request({
            url: '/rest/api/3/myself',
            success: function (response) {
              var user = JSON.parse(response).self;
              baseUrl = extractBaseUrl(user);
              console.log(baseUrl);
            },
            error: function (response) {
              console.error('Error:', response);
            }
          })
          // you can delete these later ,this is to debug the response we get from myself API
          AP.request({
            url: '/rest/api/3/myself',
            success: function (response) {
              var user = JSON.parse(response);
              console.log(user);
              var emailAddress = user.emailAddress;
              console.log("getting user email");
              console.log(emailAddress);
              // Use the email address as needed
            },
            error: function (response) {
              console.error('Error:', response);
            }
          });
          const payload = {
            username: emailaddress,
            projectKey: authToken,
            issueKey: issueid,
            baseaddress: baseUrl
          };
          AP.request({
            url: 'http://127.0.0.1:8000/scrib/', // Replace with your API URL
            type: 'POST',
            contentType: 'application/json',
            data: JSON.stringify(payload),
            success: function (response) {
              // Handle the API response here
              var endpointdjango = JSON.parse(response);
              console.log(endpointdjango);
              console.log(baseUrl);
            },
            error: function (response) {
              console.error('Error:', response);
            }
          });



        },
        Error: function (response) { AP.flag.create({ title: 'Error', body: JSON.stringify(response), type: 'error' }) },
      });


    }

    function updateIssue() {
      AP.request('/rest/api/3/issue' + document.getElementById("issueKey").value, {
        type: "PUT",
        data: JSON.stringify({ fields: { summary: document.getElementById("issueSummary").value, } }),
        contentType: "application/json",
        success: function (response) {
          AP.flag.create({ title: 'Success', body: "Issue updated", type: 'Success' });
        },
        Error: function (response) {
          AP.flag.create({ title: 'Error updating Issue', body: JSON.stringify(response), type: 'error' });
        }
      });


    }
  </script>



  <header class="aui-page-header">
    <div class="aui-page-header-inner">
      <div class="aui-page-header-main intro-header">
        <h1>Manual Test Case Generator</h1>
      </div>
    </div>
  </header>

  <div class="aui-page-panel main-panel">
    <div class="aui-page-panel-inner">
      <section class="aui-page-panel-item">
        <div class="aui-group">
          <div class="aui-item">
            <p>
              Auth token : <input id="AuthToken" />
              Story ID : <input id="issueKey" />
              Story Description : <input id="issueSummary" />
            </p>
            <p>
              <button class="aui-button" type="button" onclick="getIssue()">Proceed</button>
            </p>
          </div>
        </div>
      </section>
    </div>
  </div>
type or paste code here