-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
64 lines (62 loc) · 1.86 KB
/
index.html
File metadata and controls
64 lines (62 loc) · 1.86 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
<!doctype html>
<html>
<head>
<title>Descope WC demo app</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- Uncomment next section if you want to test CSP -->
<!-- <meta
http-equiv="Content-Security-Policy"
content="connect-src 'self' static.descope.com api.descope.com;
style-src 'unsafe-inline' fonts.googleapis.com;
img-src static.descope.com content.app.descope.com;
font-src fonts.gstatic.com;
script-src 'self' static.descope.com;"
/> -->
<style>
body {
background-color: antiquewhite;
position: relative;
height: 100vh;
margin: 0;
}
.login-container {
width: 500px;
min-height: 300px;
margin: auto;
position: relative;
top: 50%;
transform: translateY(-50%);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
</style>
</head>
<body>
<script src="https://cdn.jsdelivr.net/npm/@descope/web-component"></script>
<div class="login-container">
<descope-wc
project-id="P2S4VEcBZP5ujgEvgcp50og470Na"
flow-id="sign-in"
></descope-wc>
</div>
<script>
// Translate or modify the error as needed
function translateError(error) {
const translationMap = {
SAMLStartFailed: 'Failed to start SAML flow',
};
return translationMap[error.type] || error.text;
}
const descopeWcEle = document.getElementsByTagName('descope-wc')[0];
descopeWcEle.errorTransformer = translateError;
descopeWcEle.addEventListener('error', (e) =>
alert(`Error! - ${e.detail.errorMessage}`),
);
descopeWcEle.addEventListener('success', (e) =>
alert(`Success! - ${JSON.stringify(e.detail)}`),
);
</script>
</body>
</html>