-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathindex.php
38 lines (34 loc) · 938 Bytes
/
index.php
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
<?php require_once('config.php'); ?>
<?php
function base64url_encode($data) {
return rtrim(strtr(base64_encode($data), '+/', '-_'), '=');
}
function generate_state_parameter() {
if (isset($_SESSION['state'])) {
return $_SESSION['state'];
} else {
$state = base64url_encode(openssl_random_pseudo_bytes(32));
$_SESSION['state'] = $state;
return $state;
}
}
if (!session_id()) {
session_start();
}
$state = generate_state_parameter();
?>
<!-- =======================================================-->
<!DOCTYPE html>
<html>
<head>
<title>PHP Sample</title>
</head>
<body>
<script src='https://clef.io/v3/clef.js'
class='clef-button'
data-app-id='<?php echo APP_ID ?>'
data-redirect-url='http://localhost:8888/clef.php'
data-state='<?php echo $state ?>'>
</script>
</body>
</html>