tauri-plugin-social-auth
Native social auth plugin for Tauri applications.
The plugin exposes one command surface for Apple, Google, VK ID, and Yandex, and delegates the actual sign-in flow to the native SDK available on the current platform.
What the plugin does:
- starts native provider auth
- returns normalized success payloads to JavaScript
- returns deterministic failures when native auth cannot be completed
What the plugin does not do:
- web OAuth
- browser fallback
- backend token exchange
- session management
Those parts belong to the application.
Platform behavior
| Provider | iOS | macOS | Android | Web |
|---|---|---|---|---|
| Apple | Native | Native | Unsupported | Unsupported |
| Native | Unsupported | Native | Unsupported | |
| VK ID | Native | Unsupported | Native | Unsupported |
| Yandex | Native | Unsupported | Native | Unsupported |
Unsupported means the command rejects with SOCIAL_AUTH_UNSUPPORTED_PLATFORM.
Commands
plugin:social-auth|apple_sign_inplugin:social-auth|google_sign_inplugin:social-auth|vk_sign_inplugin:social-auth|yandex_sign_in
Success payloads
Apple:
Google:
VK ID:
deviceId is returned by the iOS native VK flow and can be omitted on other platforms.
Yandex:
Install
Add the Rust dependency:
[]
= "1.1"
Register the plugin in your Tauri app:
Declare the plugin commands for Tauri capability generation in src-tauri/build.rs:
Allow the plugin in your capability file:
JavaScript usage
import { invoke } from '@tauri-apps/api/core';
export async function signInWithApple() {
return invoke<{
idToken: string;
userIdentifier: string;
authorizationCode?: string;
email?: string;
givenName?: string;
familyName?: string;
}>('plugin:social-auth|apple_sign_in');
}
export async function signInWithGoogle() {
return invoke<{ idToken: string }>('plugin:social-auth|google_sign_in');
}
export async function signInWithVk(theme?: 'light' | 'dark') {
return invoke<{ accessToken: string; deviceId?: string }>(
'plugin:social-auth|vk_sign_in',
theme ? { theme } : undefined,
);
}
export async function signInWithYandex() {
return invoke<{ accessToken: string }>('plugin:social-auth|yandex_sign_in');
}
iOS
On iOS the plugin uses native SDKs for Google, VK ID, Yandex, and Apple Sign-In.
The plugin expects these configuration values:
GOOGLE_SERVER_CLIENT_IDGOOGLE_IOS_CLIENT_IDVK_IOS_CLIENT_IDVK_IOS_CLIENT_SECRETYA_IOS_CLIENT_ID
The plugin resolves them in this order:
Info.plistSocialAuthConfig.plistfrom the app bundle
If you use SocialAuthConfig.plist, it must be present in the final app resources as SocialAuthConfig.plist.
The plugin also updates the generated iOS Info.plist during tauri ios ... builds so that:
- required URL schemes are present for Google, VK ID, and Yandex
- required
LSApplicationQueriesSchemesentries are present for VK ID and Yandex
The app still must provide:
Sign in with Applecapability- entitlement
com.apple.developer.applesignin = ["Default"] - the provider config values listed above
At build time the plugin also:
- copies required SwiftPM
*.bundleresources into the final iOS app - re-signs embedded SwiftPM binaries for device builds when needed
macOS
On macOS only apple_sign_in is implemented natively.
The app must provide:
Sign in with Applecapability- entitlement
com.apple.developer.applesignin = ["Default"]
If your app uses this plugin on macOS, src-tauri/build.rs must also inject Swift runtime rpath entries into the final executable:
Important:
- Apple Sign-In on macOS must be tested with a signed
.appbundle that actually carries the entitlement - an unsigned
cargo run/ baretarget/debug/<app>binary is not a valid test target for Apple Sign-In
Android
On Android the plugin uses native Google, VK ID, and Yandex SDK flows.
The app must provide:
GOOGLE_SERVER_CLIENT_IDinBuildConfig- valid provider SDK setup for VK ID and Yandex in the Android project
apple_sign_in is intentionally unsupported on Android.
Browser fallback
Browser fallback is intentionally outside the plugin.
The recommended application contract is:
- call the native plugin command first
- if native auth fails and your product allows fallback, start browser OAuth in the app layer
- complete the backend exchange in the app/backend layer exactly as you would for your web flow
This keeps native auth and web auth clearly separated.
Error codes
Common:
SOCIAL_AUTH_UNSUPPORTED_PLATFORM
Apple:
APPLE_AUTH_CANCELEDAPPLE_AUTH_FAILEDAPPLE_ID_TOKEN_EMPTY
On macOS, apple_sign_in currently returns a human-readable bridge error string rather than a structured code.
Google:
GOOGLE_AUTH_CANCELEDGOOGLE_SIGN_IN_INIT_FAILEDGOOGLE_SIGN_IN_FAILEDGOOGLE_TOKEN_PARSE_FAILEDGOOGLE_ID_TOKEN_EMPTYGOOGLE_CREDENTIAL_MANAGER_FAILEDGOOGLE_UNSUPPORTED_CREDENTIALGOOGLE_AUTH_IOS_SDK_MISSING
VK ID:
VK_AUTH_CANCELEDVK_AUTH_INIT_FAILEDVK_AUTH_FAILEDVK_ACCESS_TOKEN_EMPTYVK_AUTH_IOS_SDK_MISSINGVK_AUTH_IOS_URL_SCHEME_MISSING
Yandex:
YANDEX_AUTH_CANCELEDYANDEX_AUTH_INIT_FAILEDYANDEX_AUTH_FAILEDYANDEX_ACCESS_TOKEN_EMPTYYANDEX_AUTH_IOS_SDK_MISSINGYANDEX_AUTH_IOS_URL_SCHEME_MISSING
Notes
- This plugin was fully developed with the help of AI.
License
MIT or Apache-2.0.