npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

tauri-plugin-plauth-api

v1.0.4

Published

Tauri plugin for authentication (PLAUTH) supporting macOS and iOS platforms with ASWebAuthenticationSession

Readme

Tauri Plugin PLAUTH

A Tauri plugin for authentication (PLAUTH) that currently supports macOS and iOS platforms only. The plugin implements ASWebAuthenticationSession for secure web-based authentication flows.

Crates.io Crates.io License: MIT

Platform Support

| Platform | Status | Notes | | -------- | ---------------- | -------------------------- | | macOS | ✅ Full | Web view integration | | iOS | ❌ Full | ASWebAuthenticationSession | | Android | ❌ Not supported | Not planned | | Linux | ❌ Not supported | Not planned | | Windows | ❌ Not supported | Not planned |

Features

  • macOS: Full support with web view integration and ASWebAuthenticationSession
  • iOS: Full support with ASWebAuthenticationSession and UIKit integration
  • Android: Not currently supported
  • Linux: Not currently supported
  • Windows: Not currently supported

Installation

Rust Dependencies

Add the following to your Cargo.toml:

[dependencies]
tauri-plugin-plauth = "1.0.0"

Or use the cargo add command:

cargo add tauri-plugin-plauth

JavaScript/TypeScript Dependencies

npm install tauri-plugin-plauth-api
# or
yarn add tauri-plugin-plauth-api

Usage

Rust Setup

In your src-tauri/build.rs:

fn main() {
    tauri_plugin_plauth::build();
}

In your src-tauri/src/main.rs:

fn main() {
    tauri::Builder::default()
        .plugin(tauri_plugin_plauth::init())
        .run(tauri::generate_context!())
        .expect("error while running tauri application");
}

JavaScript/TypeScript Usage

import { authenticate } from "tauri-plugin-plauth-api";

// Basic authentication
try {
  const result = await authenticate({
    url: "https://example.com/auth",
    callback_url_scheme: "myapp://callback",
  });
  console.log("Authentication successful:", result);
} catch (error) {
  console.error("Authentication failed:", error);
}

API Reference

authenticate(request: AuthRequest): Promise<AuthResponse>

Initiates an authentication flow using ASWebAuthenticationSession (iOS) or web view (macOS).

Parameters

  • url (string): The authentication URL to navigate to
  • callback_url_scheme (string): The URL scheme to handle the callback
  • presentation_context_provider (optional): Custom presentation context provider

Returns

  • AuthResponse: Object containing the authentication result

Examples

  • examples/tauri-app/ - Example Tauri application demonstrating plugin usage on macOS with React frontend
  • iOS support is available through the same plugin interface with ASWebAuthenticationSession integration

Code Organization & Structure

Rust Code Structure

  • src/lib.rs - Main plugin entry point and exports
  • src/commands.rs - Tauri command implementations
  • src/models.rs - Data structures and types
  • src/error.rs - Error handling and custom error types
  • src/desktop.rs - macOS-specific implementations
  • src/mobile.rs - iOS-specific implementations

Platform-Specific Code

  • ios/ - iOS-specific Swift code with ASWebAuthenticationSession
  • macos/ - macOS-specific Swift code with ASWebAuthenticationSession
  • guest-js/ - JavaScript/TypeScript client code
  • Note: Android support is not currently implemented

Known Issues

Authentication Dialog Shows "(null)" During Development

Issue: When running the application in development mode (cargo tauri dev), the authentication dialog may display "(null)" instead of the proper application name.

Cause: This is a known issue with Tauri development mode where the application metadata is not properly loaded.

Solutions:

1. Test with Built Bundle (Recommended)

Build and test the application as a bundle instead of development mode:

cd examples/tauri-app
cargo tauri build
# Test the built .app bundle or .dmg file

2. Check Tauri Configuration

Ensure your tauri.conf.json has the correct productName:

{
  "productName": "Your App Name",
  "version": "0.1.0",
  "identifier": "com.yourcompany.yourapp"
}

3. Add/Update Info.plist

Create or update src-tauri/Info.plist with proper bundle information:

<?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>ITSAppUsesNonExemptEncryption</key>
  <false/>
  <key>CFBundleVersion</key>
  <string>1</string>
  <key>CFBundleDisplayName</key>
  <string>Your App Name</string>
  <key>CFBundleName</key>
  <string>Your App Name</string>
</dict>
</plist>

Note: This issue only affects development mode and will not occur in production builds.

Development

Prerequisites

  • Rust 1.77.2+
  • Tauri 2.7.0+
  • Xcode (for iOS and macOS development)
  • macOS (for development and testing)
  • iOS Simulator or device (for iOS testing)

Building

# Build Rust plugin
cargo build

# Build JavaScript/TypeScript client
yarn build

Testing

# Run Rust tests
cargo test

# Run example app
cd examples/tauri-app
cargo tauri dev

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

If you encounter any issues or have questions, please:

  1. Check the examples for usage patterns
  2. Search existing issues
  3. Create a new issue with detailed information about your problem

Changelog

1.0.0

  • Initial release
  • macOS and iOS support
  • ASWebAuthenticationSession integration
  • Basic authentication flow