-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
55 lines (48 loc) · 1.71 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>ID Perú - Example JS</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
</head>
<body>
<div class="container">
<div class="row">
<div class="col-sm-12">
<h1 class="text-center">ID Perú</h1>
<h4 class="text-center">JS Example Integration</h4>
<div class="col-sm-12 text-center">
<button id="btn_login" class="btn btn-success">Ingresar</button>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript" src="https://idaas.reniec.gob.pe/service/dist/reniec_idaas.js"></script>
<script type="text/javascript">
var BASE_URL = 'http://localhost/integration_js_example';
ReniecIDaaS.init({
clientId: 'G2FoBf0QWuIT2nEacZyT_GbC-LU',
responseTypes: [
ReniecIdaasConst.RESPONSE_TYPE_ID_TOKEN,
ReniecIdaasConst.RESPONSE_TYPE_TOKEN
],
scopes: [
ReniecIdaasConst.SCOPE_PROFILE
]
});
ReniecIDaaS.onCancel(function () {
console.log('cancel');
});
ReniecIDaaS.onSuccess(function (response) {
localStorage.setItem('authResponse', JSON.stringify(response));
location.href = BASE_URL + '/home.html';
});
$('#btn_login').click(function () {
ReniecIDaaS.auth();
});
</script>
</body>
</html>