Created
August 15, 2018 17:46
-
-
Save slominskir/547730097f9950356df34eb29270c911 to your computer and use it in GitHub Desktop.
Example keycloak js client showing check-sso error
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<!-- USAGE: | |
(1) replace myserver.example.com with your keycloak server | |
(2) replace myrealm with realm | |
(3) replace myclient with cliend ID | |
--> | |
<html> | |
<head> | |
<title>Keycloak js client example</title> | |
</head> | |
<body> | |
<script src="https://myserver.example.com/auth/js/keycloak.js"></script> | |
<script> | |
var keycloak = Keycloak({ | |
url: 'https://myserver.example.com/auth', | |
realm: 'myrealm', | |
clientId: 'myclient' | |
}); | |
keycloak.init({onLoad: 'check-sso'}).success(function (authenticated) { | |
if (authenticated) { | |
console.log('authenticated'); | |
} else { | |
console.log('not authenticated'); | |
} | |
}).catch(function () { | |
alert('failed to initialize'); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment