misskey_auth 0.2.0-beta.3 copy "misskey_auth: ^0.2.0-beta.3" to clipboard
misskey_auth: ^0.2.0-beta.3 copied to clipboard

Flutter library for Misskey authentication. Supports OAuth 2.0 with PKCE, MiAuth, and secure multi-account token management for iOS, Android, and macOS.

日本語 | 简体中文 | Deutsch | Français | 한국어

misskey_auth #

Demo

License

A Flutter library for authenticating with Misskey servers. It supports both OAuth 2.0 and MiAuth, and stores tokens for multiple accounts.

Features #

  • OAuth 2.0 authentication for Misskey servers (v2023.9.0 and later)
  • MiAuth authentication for older servers
  • Authentication in the external browser (no embedded WebView)
  • PKCE (Proof Key for Code Exchange)
  • Callbacks to the app through a custom URL scheme
  • Secure token storage using flutter_secure_storage
  • Token storage for multiple accounts and switching the active account
  • Revoking the token on the server when signing out (Misskey 2026.9.0 and later)
  • MisskeyAuthManager, a high-level API that runs the flows and saves tokens
  • iOS, Android, and macOS

Requirements #

  • Flutter 3.47.1 or later, and Dart 3.13.1 or later (before Dart 4)
  • Android API 24 or later, with compileSdk 37 or later
  • iOS 15 or later
  • macOS 12.0 or later

If you are upgrading from an earlier version, read Upgrading first. On Android, users must sign in again.

Installation #

dependencies:
  misskey_auth: ^0.2.0-beta.3

Quick Start #

import 'package:misskey_auth/misskey_auth.dart';

final auth = MisskeyAuthManager.defaultInstance();

// OAuth (Misskey v2023.9.0 and later)
final oauthKey = await auth.loginWithOAuth(
  MisskeyOAuthConfig(
    host: 'misskey.io',
    clientId: 'https://yourpage/yourapp/',
    redirectUri: 'yourscheme://oauth/callback',
    scope: 'read:account write:notes',
    callbackScheme: 'yourscheme',
  ),
  setActive: true,
);

// MiAuth (also works on older servers)
final miKey = await auth.loginWithMiAuth(
  MisskeyMiAuthConfig(
    host: 'misskey.io',
    appName: 'Your App',
    callbackScheme: 'yourscheme',
    permissions: ['read:account', 'write:notes'],
  ),
  setActive: true,
);

// Read the saved token of the active account
final current = await auth.currentToken();

Before this code works, you need two things:

  1. A client_id page (OAuth only). Publish an HTTPS page that lists your redirect_uri in <link rel="redirect_uri">. See client_id Page.
  2. A custom URL scheme registered in your app. Add yourscheme to Info.plist on iOS and to CallbackActivity of flutter_web_auth_2 on Android. macOS needs no registration, but it needs entitlements for network access and the keychain. See Platform Setup.

Documentation #

License #

This project is published by 司書 (LibraryLibrarian) under the 3-Clause BSD License. See LICENSE.

1
likes
160
points
538
downloads

Documentation

API reference

Publisher

verified publisherlibrarylibrarian.com

Weekly Downloads

Flutter library for Misskey authentication. Supports OAuth 2.0 with PKCE, MiAuth, and secure multi-account token management for iOS, Android, and macOS.

Homepage
Repository (GitHub)
View/report issues

Topics

#authentication #oauth #misskey #social-media #api

License

BSD-3-Clause (license)

Dependencies

crypto, cupertino_icons, dio, flutter, flutter_secure_storage, flutter_web_auth_2, platform

More

Packages that depend on misskey_auth