Skip to content

Commit 5cde98b

Browse files
committed
Add Oauth
1 parent 11d6d34 commit 5cde98b

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

_layouts/default.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
var webAuth = new auth0.WebAuth({
2424
clientID: 'In43D8hfptI5B17Xo7XZX4aBkhfMuH56',
2525
domain: 'auth.coderic.org',
26+
audience: `https://coderic.eu.auth0.com/api/v2/`,
27+
scope: 'openid profile email',
2628
redirectUri: 'https://'+window.location.hostname+'/',
2729
responseType: 'token id_token'
2830
});
@@ -41,6 +43,11 @@
4143
$(".guest").show();
4244
$(".authenticated").hide();
4345
} else {
46+
webAuth.client.userInfo(result.accessToken, function(err, user) {
47+
if (!err && user) {
48+
$("#username").text(user.name).show();
49+
}
50+
});
4451
$(".guest").hide();
4552
$(".authenticated").show();
4653
}

_layouts/layout_en.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
d="M16,2A14,14,0,1,0,30,16,14.0158,14.0158,0,0,0,16,2ZM10,26.3765V25a3.0033,3.0033,0,0,1,3-3h6a3.0033,3.0033,0,0,1,3,3v1.3765a11.8989,11.8989,0,0,1-12,0Zm13.9925-1.4507A5.0016,5.0016,0,0,0,19,20H13a5.0016,5.0016,0,0,0-4.9925,4.9258,12,12,0,1,1,15.985,0Z" />
7979
<rect id="_Transparent_Rectangle_" data-name="&lt;Transparent Rectangle&gt;" class="cls-1" width="32"
8080
height="32" style="fill: none" />
81-
</svg> <span class="hidden sm:inline-block">Username</span>
81+
</svg> <span class="hidden sm:inline-block" id="username"></span>
8282
</a>
8383
</li>
8484
<li>

0 commit comments

Comments
 (0)