-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
68 lines (51 loc) · 2.19 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Get Access Token</title>
</head>
<body>
<img src="Sfmc.jpg" alt="SFMC TOKEN GENERATOR">
<h1>Get Access Token</h1>
<form id="postmanForm" action="http://localhost:3000" method="POST">
<label for="clientId">Client ID:</label>
<input type="text" id="clientId" name="clientId" required><br>
<label for="clientSecret">Client Secret:</label>
<input type="text" id="clientSecret" name="clientSecret" required><br>
<label for="account_id">Business Unit (MID):</label>
<input type="number" id="account_id" name="account_id" required><br>
<label for="SubDomain">SubDomain:</label>
<input type="text" id="SubDomain" name="SubDomain" required><br>
<button type="button" onclick="getAccessToken()">Get Access Token</button>
</form>
<div id="accessTokenResult"></div>
<script>
async function getAccessToken() {
const clientId = document.getElementById('clientId').value;
const clientSecret = document.getElementById('clientSecret').value;
const account_id = document.getElementById('account_id').value;
const SubDomain = document.getElementById('SubDomain').value;
try {
const response = await fetch('http://localhost:3000', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
clientId,
clientSecret,
account_id,
SubDomain,
}),
});
const data = await response.json();
document.getElementById('accessTokenResult').innerHTML = `Access Token: ${data.accessToken}`;
} catch (error) {
console.error('Error:', error);
document.getElementById('accessTokenResult').innerHTML = 'Error getting access token';
}
}
</script>
</body>
</html>