Added OAuth sample code: https://github.com/manfredsteyer/angular-oauth2-oidc/tree/master/projects/sample
This commit is contained in:
27
src/silent-refresh.html
Normal file
27
src/silent-refresh.html
Normal file
@@ -0,0 +1,27 @@
|
||||
<html>
|
||||
<body>
|
||||
<script>
|
||||
var checks = [
|
||||
/[\?|&|#]code=/,
|
||||
/[\?|&|#]error=/,
|
||||
/[\?|&|#]token=/,
|
||||
/[\?|&|#]id_token=/
|
||||
];
|
||||
|
||||
function isResponse(str) {
|
||||
var count = 0;
|
||||
if (!str) return false;
|
||||
for (var i = 0; i < checks.length; i++) {
|
||||
if (str.match(checks[i])) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
var message = isResponse(location.hash)
|
||||
? location.hash
|
||||
: '#' + location.search;
|
||||
|
||||
(window.opener || window.parent).postMessage(message, location.origin);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user