You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please note that the lib performs a token refresh when the session changes to get the newest information about the current session. When using implicit flow, this means you have to configure [silent refresh](./silent-refresh.html); when using code flow you either need silent refresh or a [refresh token](./refreshing-a-token.html).
35
+
36
+
If using refresh tokens, your Auth Server needs to bind them to the current session's lifetime. Unfortunately, the used version of Identity Server 4, shown in the docs and in the example applications, does not support this at the moment.
37
+
32
38
## Events
33
39
To get notified, you can hook up for the event ``session_terminated``:
Copy file name to clipboardExpand all lines: docs-src/silent-refresh.md
+25
Original file line number
Diff line number
Diff line change
@@ -58,6 +58,31 @@ This file is loaded into the hidden iframe after getting new tokens. Its only ta
58
58
</html>
59
59
```
60
60
61
+
This simple implementation within silent-refresh.html is sufficient in most cases. It takes care of the hash fragment as well as of the query string (property search). For **edge cases** you need to check if the received hash fragment is a token response. For this, please go with the following **more advanced implementation**:
62
+
63
+
```html
64
+
<html>
65
+
<body>
66
+
<script>
67
+
var checks = [/[\?|&|#]code=/,/[\?|&|#]error=/,/[\?|&|#]token=/,/[\?|&|#]id_token=/];
68
+
69
+
functionisResponse(str) {
70
+
var count =0;
71
+
if (!str) returnfalse;
72
+
for(var i=0; i<checks.length; i++) {
73
+
if (str.match(checks[i])) returntrue;
74
+
}
75
+
returnfalse;
76
+
}
77
+
78
+
var message =isResponse(location.hash) ?location.hash:'#'+location.search;
Please make sure that this file is copied to your output directory by your build task. When using the CLI you can define it as an asset for this. For this, you have to add the following line to the file ``.angular-cli.json``:
0 commit comments