webauthn-json icon indicating copy to clipboard operation
webauthn-json copied to clipboard

NextJS App Router - Server-Side Compatibility

Open renchris opened this issue 2 years ago • 3 comments

Hello,

I'm looking to use this library in my NextJS app router project. Is there any way to make and use this library to be server-side environment compatible?

This library is client-side per the description: @github/webauthn-json is a client-side Javascript library, however, the application logic for WebAuthN authentication is server-side, so the usage is currently not usable.

renchris avatar Jul 11 '23 03:07 renchris

The current error I am with is

Unhandled Runtime Error Error: navigator is not defined

on

const credential = await create({

renchris avatar Jul 11 '23 03:07 renchris

I'm looking to use this library in my NextJS app router project. Is there any way to make and use this library to be server-side environment compatible?

Do you have a specific goal for this?

This library is designed specifically for client WebAuthn authentication, without any server-specific functionality. I don't know of a use case for a server to act like a WebAuthn client.

If you want to perform server-side WebAuthn logic in JavaScript, you may want to look at another library like: https://simplewebauthn.dev/

lgarron avatar Jul 12 '23 01:07 lgarron