
Security News
Cline CLI npm Package Compromised via Suspected Cache Poisoning Attack
A compromised npm publish token was used to push a malicious postinstall script in cline@2.3.0, affecting the popular AI coding agent CLI with 90k weekly downloads.
@fabianlars/tauri-plugin-oauth
Advanced tools
A Tauri plugin for spawning a localhost server. Needed for some oauth flows (Login with X).
A minimalistic Rust library and Tauri plugin for handling browser-based OAuth flows in desktop applications. This plugin spawns a temporary localhost server to capture OAuth redirects, solving the challenge of using OAuth with desktop apps.
Many OAuth providers (like Google and GitHub) don't allow custom URI schemes ("deep links") as redirect URLs. This plugin provides a solution by:
Note: For an alternative approach using deep linking, see tauri-plugin-deep-link. The deep-link plugin can automatically start your app if there's no open instance.
# Cargo.toml
[dependencies]
tauri-plugin-oauth = "2"
For Tauri projects using npm or yarn:
npm install @fabianlars/tauri-plugin-oauth@2
# or
yarn add @fabianlars/tauri-plugin-oauth@2
use tauri::{command, Emitter, Window};
use tauri_plugin_oauth::start;
#[command]
async fn start_server(window: Window) -> Result<u16, String> {
start(move |url| {
// Because of the unprotected localhost port, you must verify the URL here.
// Preferebly send back only the token, or nothing at all if you can handle everything else in Rust.
let _ = window.emit("redirect_uri", url);
})
.map_err(|err| err.to_string())
}
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
tauri::Builder::default()
.plugin(tauri_plugin_oauth::init())
.invoke_handler(tauri::generate_handler![start_server])
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
import { start, cancel, onUrl, onInvalidUrl } from '@fabianlars/tauri-plugin-oauth';
async function startOAuthFlow() {
try {
const port = await start();
console.log(`OAuth server started on port ${port}`);
// Set up listeners for OAuth results
await onUrl((url) => {
console.log('Received OAuth URL:', url);
// Handle the OAuth redirect
});
// Initiate your OAuth flow here
// ...
} catch (error) {
console.error('Error starting OAuth server:', error);
}
}
// Don't forget to stop the server when you're done
async function stopOAuthServer() {
try {
await cancel(port);
console.log('OAuth server stopped');
} catch (error) {
console.error('Error stopping OAuth server:', error);
}
}
You can configure the plugin behavior using the OauthConfig struct:
use tauri_plugin_oauth::OauthConfig;
let config = OauthConfig {
ports: Some(vec![8000, 8001, 8002]),
response: Some("OAuth process completed. You can close this window.".into()),
};
start_with_config(config, |url| {
// Handle OAuth URL
})
.await
.expect("Failed to start OAuth server");
Contributions are always welcome! Please feel free to submit a Pull Request.
This project is dual-licensed under either of the following licenses, at your option:
FAQs
A Tauri plugin for spawning a localhost server. Needed for some oauth flows (Login with X).
The npm package @fabianlars/tauri-plugin-oauth receives a total of 4,504 weekly downloads. As such, @fabianlars/tauri-plugin-oauth popularity was classified as popular.
We found that @fabianlars/tauri-plugin-oauth demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
A compromised npm publish token was used to push a malicious postinstall script in cline@2.3.0, affecting the popular AI coding agent CLI with 90k weekly downloads.

Product
Socket is now scanning AI agent skills across multiple languages and ecosystems, detecting malicious behavior before developers install, starting with skills.sh's 60,000+ skills.

Product
Socket now supports PHP with full Composer and Packagist integration, enabling developers to search packages, generate SBOMs, and protect their PHP dependencies from supply chain threats.