flutter_better_auth 0.2.0
flutter_better_auth: ^0.2.0 copied to clipboard
A Dart/Flutter client for the Better Auth platform, enabling secure sign-in, sign-up, and session management in Flutter applications.
Changelog #
0.2.0 #
Breaking
- Request param types corrected against the Better Auth OpenAPI schema:
signIn.email/signIn.username—rememberMeis nowbool?(wasString?).signIn.social—scopesis nowList<String>?(wasString?),requestSignUpis nowbool?(wasString?).social.link—scopesis nowList<String>?(wasString?).
SocialAccountResponse— field renamedprovider→providerId(the server returnsproviderId); addedaccountId,userId,scopes. Fixestype 'Null' is not a subtype of type 'String'onsocial.listAccounts().
Fixed
- Bodyless
POSTrequests now send an empty JSON object{}instead of an empty body, fixing serverSyntaxError: Unexpected end of JSON input(e.g.signIn.anonymous(),signOut(),revokeSessions()). Invitation.roleis now nullable to match the schema (server may omit it).- Hardened native OAuth callback parsing (
parseOAuthCallback): reads query and URL-fragment params, surfaces providererror, and logs the raw callback for debugging.
Added
- Secure cookie storage by default on native platforms (
flutter_secure_storage): session cookies are encrypted at rest and chunked to stay under the iOS Keychain item-size limit.HiveStorageremains available as an opt-in (store:), and you can supply anyStorageInterface. refreshSessionOnReconnect(defaulttrue): refreshes the session stream when the device regains connectivity (offline → online), mirroring the Expo online-manager. Pairs with the existingrefreshSessionOnAppResume.BetterAuthClientis now exported from the package barrel (package:flutter_better_auth/flutter_better_auth.dart).
Removed
- The redundant
flutter-originrequest header (the Better Auth Expo server only readsexpo-origin).
0.1.6 #
- Add One-Time Token plugin (
client.oneTimeToken):GET /one-time-token/generate,POST /one-time-token/verify. - Add Anonymous plugin:
client.anonymous.deleteAnonymousUser()(POST /delete-anonymous-user). Anonymous sign-in stays onclient.signIn.anonymous()(POST /sign-in/anonymous). - Add Passkey plugin (
client.passkey): full HTTP surface for@better-auth/passkey(generate/verify registration & authentication, list, delete, update). WebAuthn UI is left to the app (e.g.passkeys). - Add Organization plugin (
client.organization): Retrofit surface for org/members/invites/teams/roles/has-permission;set-active/set-active-teamvia Dio with JSONnullpreserved (RemoveNullsInterceptor);listMembersRawfor list-members query parity. - Add API Key plugin (
client.apiKey). - Add Two-Factor plugin (
client.twoFactor). - Session:
Session.activeTeamIdwhere teams apply; regenerated client.g.dartwhere needed. - Widgets:
BetterAuthInherit.maybeOf;StateErrorwhenBetterAuthConsumeris used outsideBetterAuthProvider. - README updates (anonymous / passkey / org),
SignInEmailResponseand model tests, example app updates.
0.1.2 #
- Remove log.
- Add condition for social auth on web
0.1.1 #
- Remove log.
0.1.0 #
- Add
flutter_auth_web_2for social auth.
0.0.9 #
- Fix body serialization
0.0.8 #
- Break changes: We change use name parameter with BodyExtra instead of Class.
- Before:
final result = await client.signIn.email( body: SignInEmailBody( email: "test@mail.com", password: "12345678", ), )- After
final result = await client.signIn.email( email: "test@mail.com", password: "12345678", );
0.0.7 #
- Fix: update api response types to use correct models from Karuppusamy
0.0.6 #
- Add JWT support
0.0.5 #
- Update readme for plugin example
0.0.4 #
- Add Email OTP
- Add plugin example in readme
0.0.3 #
- Refactoring
- Add github example from Karuppusamy
0.0.2 #
- Update readme
- Add admin plugin
0.0.1 #
- Initial release with support for:
- Default API authentication
- Social authentication
- Email, phone number, and username authentication
- Anonymous authentication