# Magic Social Auth

**Social sign-in through a single facade.**

Native Google sign-in on iOS and Android, native Apple on iOS, and a backend-hosted browser flow for GitHub, Microsoft and the rest, on iOS, Android and web. Ready-made `SocialAuthButtons` included.

## One facade. Four providers.

Google, Apple, GitHub and Microsoft on iOS, Android and web, behind a single `SocialAuth` facade. It is the client of the `magic-starter-laravel` social login, so that backend is required.

### One facade API

`SocialAuth.driver(name).signIn()` signs in, `SocialAuth.supports(name)` checks a provider and `SocialAuth.signOut()` signs out. Laravel Socialite users will know the shape.

[Learn more about One facade API](https://anilcancakir.com/magic/docs/social_auth/architecture/overview.md)

### Native sheets

Google is native on iOS and Android through `google_sign_in`, Apple on iOS through `sign_in_with_apple`. Apple on Android and web uses the browser flow.

[Learn more about Native sheets](https://anilcancakir.com/magic/docs/social_auth/basics/drivers.md)

### Browser flow with PKCE

GitHub and Microsoft use it on every platform, and Google on web. The backend hosts it; on web a popup page (`auth.html`) posts the result back.

[Learn more about Browser flow with PKCE](https://anilcancakir.com/magic/docs/social_auth/basics/flows.md)

### Connect and confirm

For accounts a signed-in user links, the driver contract offers `beginConnect`, `connect` and `confirm`.

[Learn more about Connect and confirm](https://anilcancakir.com/magic/docs/social_auth/basics/flows.md)

### Setup by command line

`social:install` does the native setup and `social:doctor` checks it and prints the backend `.env` lines.

[Learn more about Setup by command line](https://anilcancakir.com/magic/docs/social_auth/getting-started/installation.md)

### Custom drivers

Register your own with `SocialAuth.manager.extend(name, factory)`; a driver implements the `SocialDriver` contract.

[Learn more about Custom drivers](https://anilcancakir.com/magic/docs/social_auth/basics/drivers.md)

## Add it in seconds

```bash
flutter pub add magic_social_auth
```

Or add to `pubspec.yaml`:

```yaml
dependencies:
  magic_social_auth: ^1.0.2
```

Or give your AI agent this prompt:

```text
Read https://anilcancakir.com/magic/docs/social_auth/llms.txt and install the Magic Social Auth package in this project.
```

## Docs

### Getting Started

- [Installation](https://anilcancakir.com/magic/docs/social_auth/getting-started/installation.md)
- [Configuration](https://anilcancakir.com/magic/docs/social_auth/getting-started/configuration.md)

### The Basics

- [Drivers](https://anilcancakir.com/magic/docs/social_auth/basics/drivers.md)
- [Flows](https://anilcancakir.com/magic/docs/social_auth/basics/flows.md)

### Architecture

- [Architecture Overview](https://anilcancakir.com/magic/docs/social_auth/architecture/overview.md)
