Skip to content

add webauthn login/register buttons#1

Open
emoncuso wants to merge 4 commits into
mainfrom
hackweek/gaurav-demo
Open

add webauthn login/register buttons#1
emoncuso wants to merge 4 commits into
mainfrom
hackweek/gaurav-demo

Conversation

@emoncuso

Copy link
Copy Markdown
Owner

No description provided.

// figure out how to get a username
const username = yield prompt('Username:');

yield fetch('http://127.0.0.1:8200/v1/auth/webauthn/register/begin', {

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This yield syntax just adds a slightly nicer UX element for people

Comment on lines +110 to +121
return fetch(`/register/finish/${username}`, {
method: 'POST',
body: JSON.stringify({
id: credential.id,
rawId: bufferEncode(rawId),
type: credential.type,
response: {
attestationObject: bufferEncode(attestationObject),
clientDataJSON: bufferEncode(clientDataJSON),
},
}),
});

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's the finish call for the register request. Feel free to change any of this as needed.

Comment on lines +67 to +76
<li class="action">
<button
type="button"
class="link button"
disabled={{this.registerWebauthn.isRunning}}
onclick={{perform this.registerWebauthn}}
>
Register WebAuthn
</button>
</li>

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The button will show up in the account dropdown on the first login page. Seemed as good a place as any for now 🤷

Screen Shot 2022-10-19 at 2 16 01 PM

@emoncuso emoncuso changed the title add register call add webauthn login/register buttons Oct 19, 2022
disabled={{this.webauthnAuthenticate.isRunning}}
class="button is-primary {{if this.authenticate.isRunning 'is-loading'}}"
>
Sign In use WebAuthn

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to change any of the button text on the sign in page, that is here.

disabled={{this.registerWebauthn.isRunning}}
onclick={{perform this.registerWebauthn}}
>
Register WebAuthn

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to change any of the register text that is here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant