/
index.html
59 lines (54 loc) · 2.61 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
<style>
body {
font-family: system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";
background-color: white;
color: #212529;
}
.input-group {
display: flex;
height: 2.5em;
}
.input-group input {
font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
flex: 1 1 auto;
border: 1px solid #6c757d;
border-right: none;
border-radius: 4px 0 0 4px;
padding: 0 0.5em;
text-overflow: ellipsis;
}
.input-group button {
border: 1px solid #6c757d;
border-radius: 0 4px 4px 0;
cursor: pointer;
background-color: #0d6efd;
color: white;
padding: 0 0.75em;
}
</style>
<div class="container">
<h1>One more step...</h1>
<p>To continue signing in, return to your R session, which should be prompting you to provide the code below.</p>
<div class="input-group mb-3" style="width: 300px;">
<!-- Target -->
<input id="output" class="form-control" value="" readonly="">
<!-- Trigger -->
<button id="btn-copy" class="btn btn-primary" data-clipboard-target="#output">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" style="width: 1em; height: 1em; vertical-align: -.125em; fill: currentColor;"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --><path d="M502.6 70.63l-61.25-61.25C435.4 3.371 427.2 0 418.7 0H255.1c-35.35 0-64 28.66-64 64l.0195 256C192 355.4 220.7 384 256 384h192c35.2 0 64-28.8 64-64V93.25C512 84.77 508.6 76.63 502.6 70.63zM464 320c0 8.836-7.164 16-16 16H255.1c-8.838 0-16-7.164-16-16L239.1 64.13c0-8.836 7.164-16 16-16h128L384 96c0 17.67 14.33 32 32 32h47.1V320zM272 448c0 8.836-7.164 16-16 16H63.1c-8.838 0-16-7.164-16-16L47.98 192.1c0-8.836 7.164-16 16-16H160V128H63.99c-35.35 0-64 28.65-64 64l.0098 256C.002 483.3 28.66 512 64 512h192c35.2 0 64-28.8 64-64v-32h-47.1L272 448z"/></svg>
</button>
</div>
<script>
const params = new URLSearchParams(location.search);
const code = params.get("code");
const state = params.get("state");
if (code && state) {
document.getElementById("output").value = btoa(JSON.stringify({code, state}));
document.getElementById("btn-copy").addEventListener("click", () => {
navigator.clipboard.write([
new ClipboardItem({
"text/plain": new Blob([document.getElementById("output").value], {type: "text/plain"})
})
]);
});
}
</script>