-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathexample auth.html
More file actions
81 lines (77 loc) · 2.7 KB
/
example auth.html
File metadata and controls
81 lines (77 loc) · 2.7 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
81
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Token Checker</title>
<style>
body {
font-family: Arial, sans-serif;
max-width: 600px;
margin: 0 auto;
padding: 20px;
text-align: center;
}
.container {
margin-top: 50px;
padding: 30px;
border-radius: 8px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
button {
background-color: #4CAF50;
color: white;
padding: 12px 24px;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
transition: background-color 0.3s;
}
button:hover {
background-color: #45a049;
}
#token-display {
margin-top: 20px;
padding: 15px;
background-color: #f8f9fa;
border-radius: 4px;
word-break: break-all;
}
</style>
</head>
<body>
<div class="container" id="main-container">
<h1>Authentication Required</h1>
<p>Please click the button below to authenticate.</p>
<button id="auth-button">Authenticate</button>
</div>
<div class="container" id="token-container" style="display: none;">
<h1>Authentication Successful</h1>
<p>Your token:</p>
<div id="token-display"></div>
</div>
<script>
// Check for token parameter when page loads
window.onload = function() {
// Get URL parameters using URLSearchParams
const urlParams = new URLSearchParams(window.location.search);
const token = urlParams.get('token');
if (token) {
// If token exists, show the token display
document.getElementById('main-container').style.display = 'none';
document.getElementById('token-container').style.display = 'block';
document.getElementById('token-display').textContent = token;
// Remove token from URL by replacing current history state
window.history.replaceState({}, document.title, window.location.pathname);
} else {
// If no token, setup auth button
document.getElementById('auth-button').addEventListener('click', function() {
const returnTo = encodeURIComponent(window.location.href);
window.location.href = `https://rotur.dev/auth?return_to=${returnTo}`;
});
}
};
</script>
</body>
</html>