Skip to content

Commit

Permalink
encode username
Browse files Browse the repository at this point in the history
  • Loading branch information
thitu committed Aug 21, 2024
1 parent fa80da3 commit 157bddf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions examples/simple-demo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ async function enroll (event) {
}

async function authenticate (cui = false) {
const username = document.getElementById('username').value
const username = encodeURIComponent(document.getElementById('username').value)
const authentication = new trusona.WebAuthnAuthentication()
document.getElementById('credentials').replaceChildren([])

Expand Down Expand Up @@ -52,7 +52,7 @@ async function authenticate (cui = false) {
async function jwtApi (username) {
try {
// *** DO NOT USE THIS JWT GENERATOR IN A PRODUCTION ENVIRONMENT ***
const response = await fetch(`https://jwks-delegate.lab.trusona.net/jwt?sub=${username}`)
const response = await fetch(`https://jwks-delegate.lab.trusona.net/jwt?sub=${encodeURIComponent(username)}`)
const data = await response.json()
return await Promise.resolve(data.jwt)
} catch (e) {
Expand Down
Loading

0 comments on commit 157bddf

Please sign in to comment.