-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOAUTH_REDIRECT.html
More file actions
28 lines (26 loc) · 894 Bytes
/
Copy pathOAUTH_REDIRECT.html
File metadata and controls
28 lines (26 loc) · 894 Bytes
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
<!DOCTYPE html>
<html>
<head>
<title>OAuth2 Redirect</title>
</head>
<body>
<script>
// This page should be served at http://localhost:3000/oauth2/redirect
// Extract tokens from URL query parameters
const urlParams = new URLSearchParams(window.location.search);
const accessToken = urlParams.get('accessToken');
const refreshToken = urlParams.get('refreshToken');
if (accessToken && refreshToken && window.opener) {
// Send tokens to parent window
window.opener.postMessage(
{ accessToken, refreshToken },
window.location.origin
);
// Close popup
window.close();
} else {
document.body.innerHTML = '<p>Authentication failed. Please close this window and try again.</p>';
}
</script>
</body>
</html>