import { Code } from "@/components/Code"

<img align="right" src="/img/providers/apple.svg" width="64" height="65" />

# Apple Provider

## Resources

- Sign in with Apple [Overview](https://developer.apple.com/sign-in-with-apple/get-started/)
- Sign in with Apple [REST API](https://developer.apple.com/documentation/sign_in_with_apple/sign_in_with_apple_rest_api)
- [How to retrieve](https://developer.apple.com/documentation/sign_in_with_apple/sign_in_with_apple_rest_api/authenticating_users_with_sign_in_with_apple#3383773) the user's information from Apple ID servers

> **_NOTE:_**  Apple currently does not support [RedirectProxyUrl](https://github.com/nextauthjs/next-auth/blob/3ec06842682a31e53fceabca701a362abda1e7dd/packages/core/src/lib/utils/providers.ts#L48) usage.

## Setup

### Callback URL

<Code>
  <Code.Next>

```bash
https://example.com/api/auth/callback/apple
```

  </Code.Next>
  <Code.Qwik>

```bash
https://example.com/auth/callback/apple
```

  </Code.Qwik>
  <Code.Svelte>

```bash
https://example.com/auth/callback/apple
```

  </Code.Svelte>
</Code>

### Environment Variables

```
AUTH_APPLE_ID
AUTH_APPLE_SECRET
```

### Configuration

<Code>
  <Code.Next>

```ts filename="./auth.ts"
import NextAuth from "next-auth"
import Apple from "next-auth/providers/apple"

export const { handlers, auth, signIn, signOut } = NextAuth({
  providers: [Apple],
})
```

  </Code.Next>
  <Code.Qwik>

```ts filename="/src/routes/plugin@auth.ts"
import { QwikAuth$ } from "@auth/qwik"
import Apple from "@auth/qwik/providers/apple"

export const { onRequest, useSession, useSignIn, useSignOut } = QwikAuth$(
  () => ({
    providers: [Apple],
  })
)
```

  </Code.Qwik>
  <Code.Svelte>

```ts filename="./src/auth.ts"
import { SvelteKitAuth } from "@auth/sveltekit"
import Apple from "@auth/sveltekit/providers/apple"

export const { handle, signIn, signOut } = SvelteKitAuth({
  providers: [Apple],
})
```

  </Code.Svelte>
  <Code.Express>

```ts filename="/src/app.ts"
import { ExpressAuth } from "@auth/express"
import Apple from "@auth/express/providers/apple"

app.use("/auth/*", ExpressAuth({ providers: [Apple] }))
```

  </Code.Express>
</Code>
