{"id":47943669,"url":"https://github.com/fluttersdk/magic_social_auth","last_synced_at":"2026-04-04T08:17:21.358Z","repository":{"id":346672739,"uuid":"1150128826","full_name":"fluttersdk/magic_social_auth","owner":"fluttersdk","description":"Social authentication plugin for Magic Framework. Laravel Socialite-style API with extensible drivers.","archived":false,"fork":false,"pushed_at":"2026-03-24T22:54:59.000Z","size":65,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-03-26T04:21:40.019Z","etag":null,"topics":["authentication","flutter","magic-framework","oauth","social-auth","socialite"],"latest_commit_sha":null,"homepage":"https://magic.fluttersdk.com/social-auth","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fluttersdk.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-04T23:07:34.000Z","updated_at":"2026-03-24T23:34:04.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/fluttersdk/magic_social_auth","commit_stats":null,"previous_names":["fluttersdk/magic_social_auth"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/fluttersdk/magic_social_auth","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluttersdk%2Fmagic_social_auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluttersdk%2Fmagic_social_auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluttersdk%2Fmagic_social_auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluttersdk%2Fmagic_social_auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fluttersdk","download_url":"https://codeload.github.com/fluttersdk/magic_social_auth/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluttersdk%2Fmagic_social_auth/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31392536,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T04:26:24.776Z","status":"ssl_error","status_checked_at":"2026-04-04T04:23:34.147Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["authentication","flutter","magic-framework","oauth","social-auth","socialite"],"created_at":"2026-04-04T08:17:19.299Z","updated_at":"2026-04-04T08:17:21.346Z","avatar_url":"https://github.com/fluttersdk.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/fluttersdk/magic/master/.github/magic-logo.svg\" width=\"120\" alt=\"Magic Logo\" /\u003e\n\u003c/p\u003e\n\n\u003ch1 align=\"center\"\u003eMagic Social Auth\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cstrong\u003eLaravel Socialite-style social authentication for the Magic Framework.\u003c/strong\u003e\u003cbr/\u003e\n  Config-driven OAuth with extensible drivers for Google, Microsoft, GitHub, and beyond.\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://pub.dev/packages/magic_social_auth\"\u003e\u003cimg src=\"https://img.shields.io/pub/v/magic_social_auth.svg\" alt=\"pub.dev version\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/fluttersdk/magic_social_auth/actions/workflows/ci.yml\"\u003e\u003cimg src=\"https://img.shields.io/github/actions/workflow/status/fluttersdk/magic_social_auth/ci.yml?branch=master\u0026label=CI\" alt=\"CI Status\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://opensource.org/licenses/MIT\"\u003e\u003cimg src=\"https://img.shields.io/badge/License-MIT-blue.svg\" alt=\"License: MIT\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://pub.dev/packages/magic_social_auth/score\"\u003e\u003cimg src=\"https://img.shields.io/pub/points/magic_social_auth\" alt=\"pub points\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/fluttersdk/magic_social_auth/stargazers\"\u003e\u003cimg src=\"https://img.shields.io/github/stars/fluttersdk/magic_social_auth?style=flat\" alt=\"GitHub Stars\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://magic.fluttersdk.com/social-auth\"\u003eWebsite\u003c/a\u003e ·\n  \u003ca href=\"https://magic.fluttersdk.com/packages/social-auth/getting-started/installation\"\u003eDocs\u003c/a\u003e ·\n  \u003ca href=\"https://pub.dev/packages/magic_social_auth\"\u003epub.dev\u003c/a\u003e ·\n  \u003ca href=\"https://github.com/fluttersdk/magic_social_auth/issues\"\u003eIssues\u003c/a\u003e ·\n  \u003ca href=\"https://github.com/fluttersdk/magic_social_auth/discussions\"\u003eDiscussions\u003c/a\u003e\n\u003c/p\u003e\n\n---\n\n\u003e **Alpha** — `magic_social_auth` is under active development. APIs may change between minor versions until `1.0.0`.\n\n---\n\n## Why Magic Social Auth?\n\nAdding social login to a Flutter app means juggling platform-specific SDKs, OAuth redirect flows, token exchange with your backend, and wiring it all together differently for each provider. Every project reinvents the same boilerplate.\n\n**Magic Social Auth** gives you a Socialite-style facade. One config file declares your providers. One line authenticates. Drivers handle platform differences. A pluggable handler chain sends tokens to your backend.\n\n\u003e **Config-driven social auth.** Define your providers, credentials, and scopes once. Magic Social Auth handles the rest.\n\n---\n\n## Features\n\n| | Feature | Description |\n|---|---------|-------------|\n| :key: | **Socialite-Style API** | `SocialAuth.driver('google').authenticate()` — familiar, expressive |\n| :busts_in_silhouette: | **Built-in Drivers** | Google (native SDK), Microsoft (OAuth), GitHub (OAuth) out of the box |\n| :electric_plug: | **Extensible Drivers** | Add any provider via `manager.extend('apple', factory)` |\n| :arrows_counterclockwise: | **Custom Auth Handlers** | Swap the default HTTP handler for Firebase, Supabase, or anything else |\n| :iphone: | **Platform Detection** | Drivers declare supported platforms — check with `SocialAuth.supports()` |\n| :art: | **Config-Driven UI** | `SocialAuthButtons` widget renders enabled providers with icons automatically |\n| :door: | **Sign-Out Support** | `SocialAuth.signOut()` clears cached sessions across all providers |\n| :package: | **Service Provider** | Two-phase bootstrap via Magic's IoC container — zero manual wiring |\n\n---\n\n## Quick Start\n\n### 1. Add the dependency\n\n```yaml\ndependencies:\n  magic_social_auth: ^0.0.1-alpha.1\n```\n\n### 2. Register the service provider\n\n```dart\n// lib/config/app.dart\nimport 'package:magic_social_auth/magic_social_auth.dart';\n\nMap\u003cString, dynamic\u003e get appConfig =\u003e {\n  'app': {\n    'providers': [\n      // ... other providers\n      (app) =\u003e SocialAuthServiceProvider(app),\n    ],\n  },\n};\n```\n\n### 3. Create the config file\n\n```dart\n// lib/config/social_auth.dart\nimport 'package:magic/magic.dart';\n\nMap\u003cString, dynamic\u003e get socialAuthConfig =\u003e {\n  'social_auth': {\n    'endpoint': '/auth/social/{provider}',\n    'providers': {\n      'google': {\n        'enabled': true,\n        'client_id': env('GOOGLE_CLIENT_ID'),\n        'server_client_id': env('GOOGLE_SERVER_CLIENT_ID'),\n        'scopes': ['email', 'profile'],\n      },\n      'microsoft': {\n        'enabled': true,\n        'client_id': env('MICROSOFT_CLIENT_ID'),\n        'tenant': env('MICROSOFT_TENANT', 'common'),\n        'callback_scheme': 'myapp',\n        'scopes': ['openid', 'profile', 'email'],\n      },\n      'github': {\n        'enabled': true,\n        'client_id': env('GITHUB_CLIENT_ID'),\n        'callback_scheme': 'myapp',\n        'scopes': ['read:user', 'user:email'],\n      },\n    },\n  },\n};\n```\n\n### 4. Register config in main.dart\n\n```dart\n// lib/main.dart\nimport 'config/social_auth.dart';\n\nawait Magic.init(\n  configFactories: [\n    () =\u003e appConfig,\n    () =\u003e socialAuthConfig, // Add this\n  ],\n);\n```\n\n### 5. Authenticate\n\n```dart\nawait SocialAuth.driver('google').authenticate();\n```\n\nThat's it — the default `HttpSocialAuthHandler` sends the token to your Laravel backend and logs the user in via Sanctum.\n\n---\n\n## Configuration\n\nThe config file at `lib/config/social_auth.dart` controls everything:\n\n```dart\nMap\u003cString, dynamic\u003e get socialAuthConfig =\u003e {\n  'social_auth': {\n    // Backend endpoint for token exchange\n    'endpoint': '/auth/social/{provider}',\n\n    'providers': {\n      'google': {\n        'enabled': true,\n        'client_id': env('GOOGLE_CLIENT_ID'),\n        'server_client_id': env('GOOGLE_SERVER_CLIENT_ID'),\n        'scopes': ['email', 'profile'],\n      },\n      'microsoft': {\n        'enabled': true,\n        'client_id': env('MICROSOFT_CLIENT_ID'),\n        'tenant': env('MICROSOFT_TENANT', 'common'),\n        'callback_scheme': 'myapp',\n        'scopes': ['openid', 'profile', 'email'],\n      },\n      'github': {\n        'enabled': true,\n        'client_id': env('GITHUB_CLIENT_ID'),\n        'callback_scheme': 'myapp',\n        'scopes': ['read:user', 'user:email'],\n      },\n    },\n  },\n};\n```\n\nAll values are read at runtime via `ConfigRepository`. Provider-specific OAuth setup (Google Cloud Console, Azure Portal, GitHub Developer Settings) is covered in the [configuration docs](https://magic.fluttersdk.com/packages/social-auth/getting-started/configuration).\n\n---\n\n## Usage\n\n### Basic Authentication\n\n```dart\nawait SocialAuth.driver('google').authenticate();\nawait SocialAuth.driver('microsoft').authenticate();\nawait SocialAuth.driver('github').authenticate();\n```\n\n### Check Platform Support\n\n```dart\nif (SocialAuth.supports('google')) {\n  // Show Google sign-in button\n}\n```\n\n### Custom Driver\n\n```dart\n// Register in your ServiceProvider.boot()\nSocialAuth.manager.extend('apple', (config) =\u003e AppleDriver(config));\n\n// Use it\nawait SocialAuth.driver('apple').authenticate();\n```\n\n### Custom Auth Handler\n\nReplace the default HTTP handler with your own logic:\n\n```dart\nclass FirebaseAuthHandler implements SocialAuthHandler {\n  @override\n  Future\u003cvoid\u003e handle(SocialToken token) async {\n    final credential = GoogleAuthProvider.credential(\n      idToken: token.idToken,\n      accessToken: token.accessToken,\n    );\n    await FirebaseAuth.instance.signInWithCredential(credential);\n  }\n}\n\n// Register it\nSocialAuth.manager.setHandler(FirebaseAuthHandler());\n```\n\n### SocialAuthButtons Widget\n\nConfig-driven UI that renders buttons for all enabled, platform-supported providers:\n\n```dart\nSocialAuthButtons(\n  onAuthenticate: (provider) async {\n    await SocialAuth.driver(provider).authenticate();\n  },\n  loadingProvider: currentlyLoading, // shows spinner on active button\n  mode: SocialAuthMode.signIn,      // or SocialAuthMode.signUp\n)\n```\n\nRegister UI metadata for custom providers:\n\n```dart\nSocialAuth.manager.registerProviderDefaults('apple', SocialProviderDefaults(\n  label: 'Apple',\n  iconSvg: '\u003csvg\u003e...\u003c/svg\u003e',\n  order: 4,\n));\n```\n\n### Sign Out\n\n```dart\nawait SocialAuth.signOut(); // Clears cached sessions across all providers\n```\n\n---\n\n## Architecture\n\n```\nApp launch → SocialAuthServiceProvider.register()\n  → binds SocialAuthManager singleton via IoC\n  → SocialAuth facade resolves manager from container\n  → SocialAuth.driver('google') → manager.driver('google')\n    → reads config via ConfigRepository\n    → resolves built-in or custom driver\n  → driver.authenticate()\n    → driver.getToken() (native SDK / OAuth browser)\n    → manager.handleAuth(token) → handler.handle(token)\n    → default handler POSTs to backend → Auth.login()\n```\n\n**Key patterns:**\n\n| Pattern | Implementation |\n|---------|---------------|\n| Singleton Manager | `SocialAuthManager` — central orchestrator |\n| Strategy (Driver) | `GoogleDriver`, `MicrosoftDriver`, `GithubDriver` implement `SocialDriver` |\n| Handler Chain | `SocialAuthHandler` — swap HTTP for Firebase, Supabase, etc. |\n| Service Provider | Two-phase bootstrap: `register()` (sync) → `boot()` (async) |\n| IoC Container | Binding via `app.singleton()` / `Magic.make()` |\n| Static Facade | `SocialAuth` — zero-instance access to the manager |\n\n---\n\n## Documentation\n\n| Document | Description |\n|----------|-------------|\n| [Installation](https://magic.fluttersdk.com/packages/social-auth/getting-started/installation) | Adding the package and registering the provider |\n| [Configuration](https://magic.fluttersdk.com/packages/social-auth/getting-started/configuration) | Config reference, OAuth setup for Google/Microsoft/GitHub |\n| [Drivers](https://magic.fluttersdk.com/packages/social-auth/basics/drivers) | Built-in drivers and writing custom ones |\n| [Handlers](https://magic.fluttersdk.com/packages/social-auth/basics/handlers) | Default HTTP handler and custom handler implementations |\n| [Architecture](https://magic.fluttersdk.com/packages/social-auth/architecture/overview) | Manager, facade, driver, and handler patterns |\n\n---\n\n## Contributing\n\nContributions are welcome! Please see the [issues page](https://github.com/fluttersdk/magic_social_auth/issues) for open tasks or to report bugs.\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/amazing-feature`)\n3. Write tests following the [TDD flow](#) — red, green, refactor\n4. Ensure all checks pass: `flutter test`, `dart analyze`, `dart format .`\n5. Submit a pull request\n\n---\n\n## License\n\nMagic Social Auth is open-sourced software licensed under the [MIT License](LICENSE).\n\n---\n\n\u003cp align=\"center\"\u003e\n  Built with care by \u003ca href=\"https://github.com/fluttersdk\"\u003eFlutterSDK\u003c/a\u003e\u003cbr/\u003e\n  \u003csub\u003eIf Magic Social Auth helps your project, consider giving it a \u003ca href=\"https://github.com/fluttersdk/magic_social_auth\"\u003estar on GitHub\u003c/a\u003e.\u003c/sub\u003e\n\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffluttersdk%2Fmagic_social_auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffluttersdk%2Fmagic_social_auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffluttersdk%2Fmagic_social_auth/lists"}