This repository was archived by the owner on Jul 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathLogResponse.html
More file actions
70 lines (57 loc) · 1.48 KB
/
LogResponse.html
File metadata and controls
70 lines (57 loc) · 1.48 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
65
66
67
68
69
70
<html>
<head>
<title>SAC Embedding</title>
<style>
iframe {
width: 100%;
height: 900px;
}
</style>
</head>
<body>
<h1>Log on Successful</h1>
<button type="button">Display Story</button>
<iframe id="attachframe"></iframe>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$("button").click(function () {
var url = "https://<TENANT>/sap/fpa/ui/tenants/<TENANT_ID>/bo/story/<STORY_ID>"; //<<<<<<<<<<<<<<<<<<<<< NEEDS TO BE ADJUSTED!
var data = {};
// 1.step: get the access token
$.ajax({
type: 'GET',
data: JSON.stringify(data),
contentType: 'application/json',
url: '/getToken',
success: function (data) {
console.log('success');
console.log(JSON.stringify(data));
var token_details = JSON.parse(data);
var postheaders = {
'Authorization': 'Bearer ' + token_details.access_token,
};
// 2. step: get the SAC story
$.ajax({
type: 'GET',
url: url,
contentType: 'application/json',
headers: postheaders,
xhrFields: {
withCredentials: true
},
success: function (data, status, settings) {
console.log(settings.getResponseHeader("X-CSRF-Token"));
console.log(JSON.stringify(data));
$("iframe").attr("src", url);
},
error: function (xhr, ajaxOptions, thrownError) {
alert(xhr.status);
alert(thrownError);
}
});
}
});
});
</script>
</body>
</html>