tauri-apps / tauri

Build smaller, faster, and more secure desktop applications with a web frontend.
https://tauri.app
Apache License 2.0
79.46k stars 2.36k forks source link

[bug] Allow Passkeys auth support in WebView #7926

Open nikitavoloboev opened 9 months ago

nikitavoloboev commented 9 months ago

Describe the bug

Currently if you try use any Passkey auth feature with Tauri it will not work.

For example users of my Tauri app where I had auth page managed by Hanko will seen an error.

I did not find any issue related to Passkeys and Tauri so this is one.

pewsheen commented 9 months ago

I did some tests with Hanko's components, Windows, macOS, and iOS would work, but Linux seemed to lack some WebAPI to do the authentication.

Passkeys on the macOS requires setup Associated Domain Entitlement on both the client and server side. You will need to codesign your tauri app with the entitlements to make it work.

mankins commented 5 days ago

I'm trying to do this too and using @pewsheen 's suggestion am still running into an issue adding the entitlements.

I think I need a Info.plist like:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>com.apple.developer.web-browser.public-key-credential</key>
    <true/>
  </dict>
</plist>

And then do a full pnpm tauri build which does create a .dmg and .app, however when the entitlements are set in tauri.conf.json I get the same error previously reported where the app is not able to be opened.

I thought I'd add to this in case the extra context is meaningful, as it would be great to be able to support passkeys within a tauri app.

In case it helps, here's my environment:

[✔] Environment
    - OS: Mac OS 14.3.0 X64
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.77.1 (7cf61ebde 2024-03-27)
    ✔ cargo: 1.77.1 (e52e36006 2024-03-26)
    ✔ rustup: 1.27.0 (bbb9276d2 2024-03-08)
    ✔ Rust toolchain: stable-aarch64-apple-darwin (default)
    - node: 18.17.1
    - pnpm: 8.15.4
    - yarn: 1.22.19
    - npm: 9.6.7

[-] Packages
    - tauri [RUST]: 1.2.2
    - tauri-build [RUST]: 1.2.1
    - wry [RUST]: 0.23.4
    - tao [RUST]: 0.15.8
    - tauri-cli [RUST]: 2.0.0-beta.12
    - @tauri-apps/api [NPM]: 1.5.6
    - @tauri-apps/cli [NPM]: 1.5.14

[-] App
    - build-type: bundle
    - CSP: unset
    - distDir: ../build
    - devPath: http://localhost:1420/
    - framework: Svelte
    - bundler: Rollup

One lingering question I also have is...if I do get this to work would it mean that I have to make a full build each time in order to test the app? When I call the passkey function now in dev it doesn't pop up like it does in a standard browser, hence me trying to build, etc...