magic_social_auth 0.0.11
magic_social_auth: ^0.0.11 copied to clipboard
Social authentication plugin for Magic Framework. Laravel Socialite-style API with extensible drivers.
Changelog #
[Unreleased] #
0.0.11 - 2026-10-14 #
Changed #
- Every sibling floor names this batch's release.
magicmoves^0.0.28to^0.0.29;fluttersdk_artisanstays at^0.0.20. The old range already admitted 0.0.29, so a freshpub getresolves nothing differently; what changes is that the floor names the release this package is verified against. magic 0.0.29 adds two abstract members toBroadcastChannel(isSubscribed,onSubscriptionChanged) and awebOnlyWindowNameparameter toLaunchAdapter.launch(), and pulls wind 1.9.0, wheretracking-*is em; this package implements neither contract andSocialAuthButtonswrites notracking-*class, so none of it reaches it. The requirements table indoc/getting-started/installation.mdquotes the new floor. (pubspec.yaml,doc/getting-started/installation.md)
0.0.10 - 2026-10-13 #
Changed #
- Every sibling floor names this batch's release.
magicmoves^0.0.27to^0.0.28andfluttersdk_artisan^0.0.19to^0.0.20. The old ranges already admitted the new versions, so a freshpub getresolves nothing differently; what changes is that the floors name the releases this package is verified against. Neither magic 0.0.28 nor artisan 0.0.20 is breaking; artisan 0.0.20 makes a connected command that reaches an extension the app has not registered yet print one retry line and exit 75 instead of an RPC stack, and this package calls no extension, sosocial:installandsocial:doctorbehave as before. The requirements table indoc/getting-started/installation.mdquotes the new floors. (pubspec.yaml,doc/getting-started/installation.md)
0.0.9 - 2026-10-09 #
Changed #
- Every sibling floor names this batch's release.
magicmoves^0.0.24to^0.0.27andfluttersdk_artisan^0.0.18to^0.0.19. The old ranges already admitted the new versions, so a freshpub getresolves nothing differently; what changes is that the floors name the releases this package is verified against. None of magic 0.0.25 to 0.0.27 or artisan 0.0.19 is breaking; artisan 0.0.19 widens itsxmlconstraint to admit 7.x, which a consumer now inherits. The requirements table indoc/getting-started/installation.mdquotes the new floors. (pubspec.yaml,doc/getting-started/installation.md)
0.0.8 - 2026-10-05 #
Requires magic-starter-laravel with its redesigned social login (auth/social/{provider}/redirect, auth/social/exchange, auth/social/{provider}/token, user/social-accounts/link-ticket).
Added #
- Sign in with Apple, native on iOS.
AppleDriveropens the system sheet with the lowercase sha256 hex of a fresh nonce, then posts the identity token, the raw nonce and the authorization code toauth/social/apple/token. The nonce is new per sheet; the backend refuses one it has seen. The result is anAppleSignInResult, which carries thegivenNameandfamilyNameApple shares on the first authorization only. Apple on Android and the web goes through the browser flow. (lib/src/drivers/apple_driver.dart,lib/src/flow/nonce.dart) - A backend-hosted browser flow with PKCE for GitHub, Microsoft, Apple on Android and web, and Google on the web.
RedirectDrivermints aPkcepair (64-character verifier, 43-character S256 challenge), opens<network.drivers.api.base_url>/auth/social/{provider}/redirect?platform=&challenge=throughflutter_web_auth_2, takes the one-time code from the callback and trades it with the verifier atauth/social/exchange. iOS returns through a custom scheme, Android through an https App Link (Auth Tab withhttpsHostandhttpsPath), the web through a popup andweb/auth.html. A refusal arrives asSocialAuthExceptionwith the backend'scode.preferEphemeralis never set on Android. (lib/src/drivers/redirect_driver.dart,lib/src/flow/social_flow.dart,lib/src/flow/pkce.dart,lib/src/flow/web_flow_slot.dart) signIn,beginConnect,connectandconfirmon every driver, all answering aSocialAuthResult.connect(proof)links a provider to the signed-in account;proofis the step-up field the account can give (password,codeorconfirmation_token) andnullfor a guest.beginConnect(proof)does the link-ticket request first and returns the call that opens the provider, so a web popup can open from a fresh tap.confirm()re-authenticates with a linked provider and returns aconfirmationToken.SocialAuthResultexposes the token and user, the 2FA challenge (isTwoFactor,twoFactorToken),deletionCancelled,connectedProviderandconfirmationToken. Every retry mints a new PKCE pair, link ticket and proof. (lib/src/contracts/social_driver.dart,lib/src/models/social_auth_result.dart)social:installwrites the whole setup. Flags:--providers,--google-ios-client-id,--google-server-client-id,--ios-scheme,--android-callback, plus the inherited--force,--dry-run,--non-interactiveand--no-bootstrap. It publisheslib/config/social_auth.dartand registers its factory, addsGIDClientID,GIDServerClientIDand the reversed client id URL scheme toInfo.plist, writes the Sign in with Apple entitlement into every entitlements file the app target signs with, declares theCallbackActivitywith anautoVerifyhttps intent filter, writesweb/auth.html, and, when the app listsmagic_starter, publishes the starter bridge and registers it. Needsfluttersdk_artisan0.0.18. (lib/src/cli/commands/social_install_command.dart,install.yaml,assets/stubs/install/)social:doctorchecks the setup and prints the backend env. It verifies the config, the iOS keys, URL scheme and Apple entitlement in every signing file, the Android callback activity (exported,taskAffinity,autoVerifyfilter) and any other App Link filter that overlaps the callback,web/auth.html, and the starter bridge, warns when an iOS app offers a provider but not Apple (App Store guideline 4.8), and prints theMAGIC_STARTER_SOCIAL_*andMAGIC_STARTER_APPLE_*lines and the callback URL each provider console has to list. (lib/src/cli/commands/social_doctor_command.dart)SocialAuthException.codeandstatusCode, andSocialAuthCancelledException.superseded. A backend refusal is read bycode, never by message.supersededis true when another flow took the browser, so the caller stays quiet. (lib/src/exceptions/social_auth_exception.dart)- An Apple icon and label in
SocialAuthButtons, Apple first on iOS. (lib/src/ui/social_provider_icons.dart,lib/src/ui/social_auth_buttons.dart)
Changed #
- BREAKING: the package no longer creates a session. Drivers answer a
SocialAuthResult; the caller (or the magic_starter bridge) runsAuth.login, finishes a 2FA challenge and handlesdeletionCancelled.SocialAuthButtonstakes a synchronousonPressed(provider)in place ofonAuthenticate, so a web popup opens from the tap itself. (lib/src/social_auth_manager.dart,lib/src/ui/social_auth_buttons.dart) - BREAKING: Google is native on iOS and Android only, and posts its ID token to the backend. The web signs in with Google through the browser flow. No nonce is sent for Google. The SDK is initialized once per process and signed out through
signOut(). (lib/src/drivers/google_driver.dart) - BREAKING: config.
social_auth.callback.iosandsocial_auth.callback.androidare new and must equal the backend'sMAGIC_STARTER_SOCIAL_IOS_REDIRECTandMAGIC_STARTER_SOCIAL_ANDROID_REDIRECT.providers.google.ios_client_idreplacesclient_id. (assets/stubs/install/social_auth_config.stub) - BREAKING: Dart
^3.12.0, Flutter>=3.44.0(fromsign_in_with_apple8.2),flutter_web_auth_2 ^5.1.0, andfluttersdk_artisan ^0.0.18. New dependencies:sign_in_with_apple ^8.2.0,crypto ^3.0.7. (pubspec.yaml) - The documentation is rewritten for the new flows, and
doc/basics/handlers.mdis replaced bydoc/basics/flows.md. An app withoutmagic_starterhas to sign Google out on its own sign-out; the bridge does it for starter apps. (README.md,doc/,CLAUDE.md)
Removed #
- BREAKING:
SocialToken,SocialAuthHandler,HttpSocialAuthHandlerandSocialAuth.manager.setHandler(). The handler posted a provider token toauth/social/{provider}, which the backend has removed. (lib/src/models/social_token.dart,lib/src/contracts/social_auth_handler.dart) - BREAKING:
MicrosoftDriverandGithubDriver. Both providers are aRedirectDrivernow.getToken()andauthenticate()are gone fromSocialDriver. - BREAKING: the config keys
endpoint,providers.*.client_id,scopes,tenant,callback_schemeandweb_callback_url. The backend owns scopes, tenants and client secrets.
0.0.7 - 2026-09-29 #
Changed #
- Every sibling floor names this batch's release.
magicmoves^0.0.22to^0.0.24andfluttersdk_artisan^0.0.16to^0.0.17. The old ranges already admitted the new versions, so a freshpub getresolves nothing differently; what changes is that the floors name the releases this package is verified against. magic 0.0.24 removesMagicController.onRefreshUI(BREAKING); this package calls it nowhere inlib/ortest/, so nothing here moves with it. (pubspec.yaml)
0.0.6 - 2026-09-27 #
Changed #
- Every sibling floor names this batch's release.
magicmoves^0.0.16to^0.0.22;fluttersdk_artisanstays at^0.0.16, still the newest. The old ranges already admitted the new versions, so a freshpub getresolves nothing differently; what changes is that the floor names the release this package is verified against. magic 0.0.22's BREAKING changes (Magic.deletedisposing the notifier it removes,MagicTest.init()resetting the Gate and Translator,Min/Maxreading a numeric string by value besideNumeric) touch nothing this package calls. The installation guide's requirements table, which still namedmagic ^0.0.5, now matches. (pubspec.yaml,doc/getting-started/installation.md)
0.0.5 - 2026-09-22 #
Changed #
- Every sibling floor names this batch's release.
magicmoves^0.0.15to^0.0.16;fluttersdk_artisanstays at^0.0.16, still the newest. The old ranges already admitted the new versions, so a freshpub getresolves nothing differently; what changes is that the floors name the releases this package is verified against. magic 0.0.16 widensfile_pickerto admit 13, wherePlatformFile.length()answers null for an unreadable file; this package does not callPick. (pubspec.yaml)
0.0.4 - 2026-09-21 #
Changed #
- Every sibling floor names this batch's release.
magicmoves^0.0.5to^0.0.15andfluttersdk_artisan^0.0.8to^0.0.16. The old ranges already admitted the new versions, so a freshpub getresolves nothing differently; what changes is that the floors name the releases this package is verified against. magic 0.0.15 is breaking in its database layer (a migration may no longer manage its own transaction, andDB.transactionrefuses a callback that closes the transaction itself); nothing in this package calls either, so no code here changes, but an app below magic 0.0.15 no longer resolves this release. (pubspec.yaml)
0.0.3 - 2026-08-25 #
Added #
- The Google driver's error-translation contract has tests, and a seam to reach it through.
getToken's try/catch is the whole contract consumers code against: a provider failure becomesSocialAuthException, a user cancel becomesSocialAuthCancelledExceptionso "backed out" can be told from "failed", and an exception that is already ours is rethrown unchanged. Nothing covered any of it, because every route into that code runs through the platform channel.supportsNativeSignIn,nativeSignInandensureInitializedare now@visibleForTestingmembers a test subclass stands in for, and_accountToTokenisaccountToTokenfor the same reason. Four tests pin the contract; two of them fail if theawaitadded in #10 is removed, so the fix has a regression guard rather than only an analyzer warning. Additive: no existing call site changes. (lib/src/drivers/google_driver.dart,test/drivers/google_driver_test.dart) codecov.yml, with patch coverage informational and project coverage still a gate. This package is a thin wrapper over provider SDKs whose calls only exist behind a platform channel, so a one-line fix in one of those branches scores 0% patch coverage however well the surrounding behaviour is tested. That is what happened on #10. Blocking on the number pushes toward inventing a seam for every platform call, or writing assertions like "this throws without a channel" purely to colour a line green. Total coverage is the honest gate and it went 55.0% -> 57.0% with the tests above. (codecov.yml)
Fixed #
- A failure inside
_accountToTokenescaped the Google driver's error translation.getToken's native branch didreturn _accountToToken(account)inside the try whose catch clauses are the whole point of the method: they turn aGoogleSignInExceptionintoSocialAuthCancelledExceptionon a user cancel and intoSocialAuthExceptionotherwise. Returning the future unawaited means anything it throws is raised after the try has already completed, so those handlers never see it and the caller gets a raw exception instead of this package's contract. It is reachable:_accountToTokenreadsaccount.authentication.idTokenwith no guard of its own, and only its innerauthorizationForScopescall is wrapped. Nowreturn await. Surfaced by the analyzer'sunawaited_return_in_try_block, which turnedmasterred on a newer Dart than the PR that last touched the file ran against, and the warning was right. (lib/src/drivers/google_driver.dart)
0.0.2 - 2026-07-26 #
Changed #
magicconstraint bumped to^0.0.3->^0.0.5. The old bound excluded every magic release since 0.0.4: under pub's0.0.zcaret semantics^0.0.3means<0.0.4, so this plugin could not resolve alongside a consumer on current magic at all. Now tracks magic 0.0.5. No behavior change in this package.
0.0.1 - 2026-06-24 #
📚 Documentation #
- README: Rewrite to match Magic ecosystem format
- doc/ folder: Add comprehensive documentation
0.0.1-alpha.1 - 2026-03-25 #
✨ Core Features #
- Laravel Socialite-style API:
SocialAuth.driver('google').authenticate()facade pattern - Google Driver: Native Google Sign-In SDK on mobile, auth popup on web
- Microsoft Driver: OAuth authorization code flow via
flutter_web_auth_2 - GitHub Driver: OAuth browser flow with code exchange
- Extensible Drivers: Register custom drivers via
SocialAuth.manager.extend() - Custom Auth Handlers: Swap backend auth with
SocialAuth.manager.setHandler() - Platform Detection: Conditional imports for iOS, Android, Web, macOS, Windows, Linux
- SocialToken Model: Supports both token and code-exchange authentication flows
- SocialAuthButtons Widget: Config-driven UI with platform filtering and loading states
- SocialProviderIcons: SVG icon registry with custom provider support
- Service Provider: Magic Framework IoC integration via
SocialAuthServiceProvider - Sign Out: Global
SocialAuth.signOut()clears all cached driver sessions