hoauth2-demo-1.7.0: public/templates/index.mustache
<html>
<head>
<link href="/main.css" rel="stylesheet"/>
</head>
<body>
<h1>HOAuth2 Demo</h1>
<h2>Authorization Code flow</h2>
{{#idps}}
<section class="login-with">
{{^isLogin}}
<a href="/login?idp={{idpName}}">Sign in with {{idpName}}</a>
{{/isLogin}}
{{#isLogin}}
<h2>Welcome to {{idpName}}</h2>
{{#user}}
<div class="result">Hello, {{idpName}}</div>
{{/user}}
<a href="/logout?idp={{idpName}}">Logout</a>
<a href="/refresh-token?idp={{idpName}}">Refresh</a>
{{/isLogin}}
</section>
{{/idps}}
<h2>Password flow</h2>
{{#idps}}
{{#hasPasswordGrant}}
<section class="login-with">
<a href="/login/password-grant?idp={{idpName}}">Sign-in with {{idpName}}</a>
</section>
{{/hasPasswordGrant}}
{{/idps}}
<ul>
<li>Check console for login success</li>
</ul>
<h2>Client Credentials flow</h2>
{{#idps}}
{{#hasClientCredentialsGrant}}
<section class="login-with">
<a href="/login/cc-grant?idp={{idpName}}">Sign-in with {{idpName}}</a>
</section>
{{/hasClientCredentialsGrant}}
{{/idps}}
<ul>
<li>Check console for login success</li>
</ul>
<h2>JWT Bearer flow</h2>
<section class="login-with">
<a href="/login/jwt-grant">Test Google service account</a>
</section>
<ul>
<li>Check console for login success</li>
</ul>
<h2>Device Auth flow</h2>
{{#idps}}
{{#hasDeviceGrant}}
<section class="login-with">
<a href="/login/device-auth-grant?idp={{idpName}}">Sign-in with {{idpName}}</a>
</section>
{{/hasDeviceGrant}}
{{/idps}}
<ul>
<li>Check console for login success</li>
</ul>
<h2>Notes</h2>
<ol>
<li>For StackExchange, the callback URI cannot have port, hence have manually add port 9988 in browser when Stack Exchange redirects back.</li>
<li>For Slack, the callback url has to be https and without any port hence also need manual intervention. (TODO: add tls to the server)</li>
</ol>
</p>
</body>
</html>