Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug?]: issue setting up WebAuthn with dbAuth #9170

Closed
1 task
charity1475 opened this issue Sep 14, 2023 · 2 comments · Fixed by #9178
Closed
1 task

[Bug?]: issue setting up WebAuthn with dbAuth #9170

charity1475 opened this issue Sep 14, 2023 · 2 comments · Fixed by #9178
Labels
bug/confirmed We have confirmed this is a bug

Comments

@charity1475
Copy link

charity1475 commented Sep 14, 2023

What's not working?

trying to setup rw dbAuth using both username pass and WebAuthn , https://redwoodjs.com/docs/auth/dbauth . here is my prisma types:

model User {
  id                  Int              @id @default(autoincrement())
  email               String           @unique
  hashedPassword      String
  salt                String
  resetToken          String?
  resetTokenExpiresAt DateTime?
  role                String
  webAuthnChallenge   String?          @unique
  verified            Boolean          @default(false)
  credentials         UserCredential[]
}

model UserCredential {
  id         String  @id
  userId     Int
  user       User    @relation(fields: [userId], references: [id])
  publicKey  Bytes
  transports String?
  counter    BigInt
}

did every thing as in docs but could not understand this line
import WebAuthnClient from '@redwoodjs/auth/webAuthn'
when i try to import it i get the error
[plugin:vite:import-analysis] Failed to resolve import "@redwoodjs/auth/webAuthn" from "src/App.jsx". Does the file exist?

/Users/charity/Github/e-shop/web/src/App.jsx:4:27
18 |  import { RedwoodApolloProvider } from "@redwoodjs/web/apollo";
19 |  import { AuthProvider, useAuth } from "@redwoodjs/auth";
20 |  import WebAuthnClient from "@redwoodjs/auth/webAuthn";
   |                              ^
21 |  import FatalErrorPage from "./pages/FatalErrorPage/FatalErrorPage";
22 |  import Routes from "./Routes";

also in my generated pages :

import { Link, navigate, routes } from '@redwoodjs/router'
import { MetaTags } from '@redwoodjs/web'
import { toast, Toaster } from '@redwoodjs/web/toast'

import { useAuth } from 'src/auth'

const LoginPage = () => {
  const { isAuthenticated, logIn } = useAuth()

this src/auth was not generated
Self-hosted Authentication (dbAuth) | RedwoodJS Docs
Redwood's own dbAuth provides several benefits:

How do we reproduce the bug?

https://redwoodjs.com/docs/auth/dbauth

What's your environment? (If it applies)

System:
    OS: macOS 11.7.8
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.14.0 - /private/var/folders/37/06hrjysj5775q979wm1dph600000gn/T/xfs-76f46826/node
    Yarn: 3.6.3 - /private/var/folders/37/06hrjysj5775q979wm1dph600000gn/T/xfs-76f46826/yarn
  Databases:
    SQLite: 3.32.2 - /Users/charity/Library/Android/sdk/platform-tools/sqlite3
  Browsers:
    Chrome: 117.0.5938.62
    Safari: 16.6
  npmPackages:
    @redwoodjs/auth: ^6.2.1 => 6.2.1
    @redwoodjs/auth-dbauth-setup: 6.2.1 => 6.2.1
    @redwoodjs/cli-storybook: 6.2.1 => 6.2.1
    @redwoodjs/core: 6.2.1 => 6.2.1

Are you interested in working on this?

  • I'm interested in working on this
@charity1475 charity1475 added the bug/needs-info More information is needed for reproduction label Sep 14, 2023
@jtoar jtoar changed the title [Bug?]: [Bug?]: issue setting up WebAuthn with dbAuth Sep 14, 2023
@jtoar
Copy link
Contributor

jtoar commented Sep 14, 2023

hey @charity1475, thanks for reporting—unfortunately it looks like some of that documentation is outdated. instead of importing it from the auth package, it should be imported from @redwoodjs/auth-dbauth-web/webAuthn.

if you use the setup command, it'll do the right thing for you: yarn rw setup auth dbAuth. just say "yes" at the webAuthn prompt.

i'll see about updating the docs here.

@jtoar jtoar added bug/confirmed We have confirmed this is a bug and removed bug/needs-info More information is needed for reproduction labels Sep 14, 2023
@charity1475
Copy link
Author

thanks, I see.

Tobbe added a commit that referenced this issue Dec 19, 2023
Co-authored-by: Joe Thompson <[email protected]>
Co-authored-by: Tobbe Lundberg <[email protected]>
Tobbe added a commit that referenced this issue Dec 21, 2023
Co-authored-by: Joe Thompson <[email protected]>
Co-authored-by: Tobbe Lundberg <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/confirmed We have confirmed this is a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants