### Install with yarn Source: https://github.com/a-tokyo/react-apple-signin-auth/blob/main/README.md Alternative installation of react-apple-signin-auth using yarn. ```bash yarn add react-apple-signin-auth ``` -------------------------------- ### Install with npm Source: https://github.com/a-tokyo/react-apple-signin-auth/blob/main/README.md Install the react-apple-signin-auth package using npm. ```bash npm i react-apple-signin-auth ``` -------------------------------- ### Start webpack development server Source: https://github.com/a-tokyo/react-apple-signin-auth/blob/main/README.md Start the webpack development server, which will be available at localhost:3001. ```bash yarn start ``` -------------------------------- ### Install apple-signin-auth with yarn or npm Source: https://github.com/a-tokyo/react-apple-signin-auth/blob/main/README.md Install the apple-signin-auth library for server-side Apple Signin support. Use either yarn add or npm i. ```bash yarn add apple-signin-auth ``` ```bash npm i apple-signin-auth ``` -------------------------------- ### Install dependencies with yarn Source: https://github.com/a-tokyo/react-apple-signin-auth/blob/main/README.md Install the project dependencies using the yarn package manager. ```bash yarn ``` -------------------------------- ### waitForVar usage examples Source: https://github.com/a-tokyo/react-apple-signin-auth/blob/main/_autodocs/api-reference/wait-for-var.md Examples from the module's doc comment showing default polling, custom options, and dynamic poll frequency. The first uses default settings, the second customizes frequency, retries, and parent, and the third uses a function for poll frequency. ```javascript // default polling waitForVar('FB').then((FB) => FB.test()); // custom poll frequency, retries and parent waitForVar('FB', { pollFrequency: 500, retries: 2, parent: window || global }).then((FB) => FB.test()); // dynamic (function) poll frequency — the remaining retry count is passed in waitForVar('FB', { retries: ({ retries }) => retries * 500 }).then((FB) => FB.test()); ``` -------------------------------- ### Load Apple SDK with useScript hook Source: https://github.com/a-tokyo/react-apple-signin-auth/blob/main/_autodocs/api-reference/apple-auth-helpers.md Example of using the useScript hook with appleAuthHelpers.APPLE_SCRIPT_SRC to load the Apple SDK in a React component. ```jsx import { useScript, appleAuthHelpers } from 'react-apple-signin-auth'; const myComponent = () => { useScript(appleAuthHelpers.APPLE_SCRIPT_SRC); // ... }; ``` -------------------------------- ### Add React-specific ESLint plugins (eslint-plugin-react-x and eslint-plugin-react-dom) Source: https://github.com/a-tokyo/react-apple-signin-auth/blob/main/demo/README.md Install and configure eslint-plugin-react-x and eslint-plugin-react-dom in eslint.config.js. Enables recommended TypeScript rules for react-x and recommended rules for react-dom. ```JavaScript // eslint.config.js import reactX from 'eslint-plugin-react-x' import reactDom from 'eslint-plugin-react-dom' export default tseslint.config({ plugins: { // Add the react-x and react-dom plugins 'react-x': reactX, 'react-dom': reactDom, }, rules: { // other rules... // Enable its recommended typescript rules ...reactX.configs['recommended-typescript'].rules, ...reactDom.configs.recommended.rules, }, }) ``` -------------------------------- ### Basic Apple Sign-In Button Usage Source: https://github.com/a-tokyo/react-apple-signin-auth/blob/main/_autodocs/api-reference/apple-signin-button.md Basic usage from the README. Imports AppleSignin and renders it with required authOptions (clientId, scope, redirectURI, state, nonce, usePopup) and optional props like uiType, className, noDefaultStyle, buttonExtraChildren, onSuccess, and onError. ```jsx import AppleSignin from 'react-apple-signin-auth'; const MyAppleSigninButton = () => ( console.log(response)} onError={(error) => console.error(error)} /> ); export default MyAppleSigninButton; ``` -------------------------------- ### Run and update tests Source: https://github.com/a-tokyo/react-apple-signin-auth/blob/main/README.md Run the test suite locally, updating snapshots with the -u flag. ```bash yarn test -u ``` -------------------------------- ### Clone the repository Source: https://github.com/a-tokyo/react-apple-signin-auth/blob/main/README.md Clone the react-apple-signin-auth repository from GitHub to your local machine. ```bash git clone https://github.com/a-tokyo/react-apple-signin-auth ``` -------------------------------- ### Load Apple SDK with plain script tag Source: https://github.com/a-tokyo/react-apple-signin-auth/blob/main/_autodocs/api-reference/apple-auth-helpers.md Alternative way to load the Apple SDK using a plain HTML script tag with the APPLE_SCRIPT_SRC URL. ```html ``` -------------------------------- ### Apple Signin button usage with authOptions Source: https://github.com/a-tokyo/react-apple-signin-auth/blob/main/README.md Renders the Apple Signin button by passing authOptions to AppleID.auth.init(). Requires a clientId, scope, redirectURI, state, and nonce; the redirectURI must be one of the URIs added to the serviceID and localhost fails. ```jsx import AppleSignin from 'react-apple-signin-auth'; /** Apple Signin button */ const MyAppleSigninButton = () => ( ); export default MyAppleSigninButton; ``` -------------------------------- ### Entry point src/index.js Source: https://github.com/a-tokyo/react-apple-signin-auth/blob/main/_autodocs/index.md The library's entry point re-exports the default AppleSigninButton component, the named useScript hook, and appleAuthHelpers. The default export is the button component; useScript and appleAuthHelpers are named exports. src/index.test.js verifies that all three resolve to Function/Object. ```javascript /* @flow */ import AppleSigninButton from './AppleSigninButton/AppleSigninButton'; import appleAuthHelpers from './appleAuthHelpers'; export { default as useScript } from './hooks/useScript'; export { appleAuthHelpers }; export default AppleSigninButton; ``` -------------------------------- ### appleAuthHelpers.signIn promisified style with error handling Source: https://github.com/a-tokyo/react-apple-signin-auth/blob/main/_autodocs/api-reference/apple-auth-helpers.md Use this snippet to initiate Apple Sign-In with a promisified style using await. Note that this only completes with a response when usePopup is true. The response object contains an authorization.id_token property. ```javascript import { appleAuthHelpers } from 'react-apple-signin-auth'; const response = await appleAuthHelpers.signIn({ authOptions: { clientId: 'com.example.web', scope: 'email name', redirectURI: 'https://example.com', usePopup: true, }, onError: (error) => console.error(error), }); if (response) { console.log(response.authorization.id_token); } else { console.error('Error performing apple signin.'); } ``` -------------------------------- ### appleAuthHelpers.signIn Source: https://github.com/a-tokyo/react-apple-signin-auth/blob/main/_autodocs/api-reference/apple-auth-helpers.md Initiates Apple Sign-In with the provided authentication options. Supports callback style and promise-based usage, with the promise resolving only when usePopup is true. ```APIDOC ## appleAuthHelpers.signIn ### Description Initiates Apple Sign-In with the provided authentication options. Supports callback style and promise-based usage, with the promise resolving only when usePopup is true. ### Method signIn ### Parameters #### authOptions (object) - Required - **clientId** (string) - Required - The client identifier for your Apple app. - **scope** (string) - Optional - The scope of the authentication request (e.g., 'email name'). - **redirectURI** (string) - Required - The redirect URI for the authentication flow. - **state** (string) - Optional - A state parameter for CSRF protection. - **nonce** (string) - Optional - A nonce for replay protection. - **usePopup** (boolean) - Optional - If true, uses a popup flow; required for promise-based usage. #### onSuccess (function) - Optional Callback invoked with the response on successful authentication. #### onError (function) - Optional Callback invoked with the error on failed authentication. ### Request Example ```js appleAuthHelpers.signIn({ authOptions: { clientId: 'com.example.web', scope: 'email name', redirectURI: 'https://example.com', state: 'state', nonce: 'nonce', usePopup: true, }, onSuccess: (response) => console.log(response), onError: (error) => console.error(error), }); ``` ### Response #### Success Response - **response** (object) - The authentication response, containing an `authorization` object with an `id_token` property. #### Response Example ```js console.log(response.authorization.id_token); ``` ### Notes - When using promise style, the promise only resolves with a response when `usePopup: true`. - If the response is falsy, an error is logged: 'Error performing apple signin.' ``` -------------------------------- ### appleAuthHelpers.signIn callback style Source: https://github.com/a-tokyo/react-apple-signin-auth/blob/main/_autodocs/api-reference/apple-auth-helpers.md Use this snippet to initiate Apple Sign-In with a callback style. It requires a clientId, scope, redirectURI, and optionally state and nonce. The onSuccess callback receives the response, and onError receives any error. ```javascript import { appleAuthHelpers } from 'react-apple-signin-auth'; appleAuthHelpers.signIn({ authOptions: { clientId: 'com.example.web', scope: 'email name', redirectURI: 'https://example.com', state: 'state', nonce: 'nonce', usePopup: true, }, onSuccess: (response) => console.log(response), onError: (error) => console.error(error), }); ``` -------------------------------- ### signIn(props: SignInProps): Promise Source: https://github.com/a-tokyo/react-apple-signin-auth/blob/main/_autodocs/api-reference/apple-auth-helpers.md Initiates the Apple ID sign-in flow with the provided configuration. Returns a promise that resolves with the authentication response or null if the user cancels. ```APIDOC ## signIn(props: SignInProps): Promise ### Description Initiates the Apple ID sign-in flow with the provided configuration. Returns a promise that resolves with the authentication response or null if the user cancels. ### Method signIn ### Parameters #### props (SignInProps) - Required - **clientId** (string) - Required - The Apple client ID (service ID). - **redirectURI** (string) - Required - The redirect URI for the sign-in flow. - **scope** (string) - Optional - The scope of the sign-in request (e.g., 'name email'). - **state** (string) - Optional - A state string for CSRF protection. - **nonce** (string) - Optional - A nonce for the sign-in request. - **usePopup** (boolean) - Optional - Whether to use a popup for sign-in. - **responseType** (string) - Optional - The response type (e.g., 'code'). - **responseMode** (string) - Optional - The response mode (e.g., 'query'). - **onSuccess** (function) - Optional - Callback on successful sign-in. - **onError** (function) - Optional - Callback on error. ### Returns - **Promise** - Resolves with the authentication response or null if the user cancels. ### Usage Example ```js import { appleAuthHelpers } from 'react-apple-signin-auth'; appleAuthHelpers.signIn({ clientId: 'com.example.service', redirectURI: 'https://example.com/callback', scope: 'name email', state: 'state', nonce: 'nonce', usePopup: true, responseType: 'code', responseMode: 'query', onSuccess: (response) => console.log(response), onError: (error) => console.error(error), }); ``` ``` -------------------------------- ### signIn(props) Source: https://github.com/a-tokyo/react-apple-signin-auth/blob/main/_autodocs/api-reference/apple-auth-helpers.md Performs an Apple ID sign-in operation. Accepts authOptions, onSuccess, and onError callbacks. Returns a promise that resolves with the AppleAuthResponse on success or null on failure. ```APIDOC ## signIn(props) ### Description Performs an Apple ID sign-in operation. Accepts authOptions, onSuccess, and onError callbacks. Returns a promise that resolves with the AppleAuthResponse on success or null on failure. ### Method signIn ### Signature ```js const signIn = ({ authOptions, onSuccess, onError, }: { authOptions: AppleAuthOptions, onSuccess?: Function, onError?: Function, }): Promise => ``` ### Parameters - **authOptions** (AppleAuthOptions) - Required - Passed verbatim to `window.AppleID.auth.init(authOptions)`. - **onSuccess** (Function) - Optional - Called with the sign-in response; only invoked when `authOptions.usePopup === true`. - **onError** (Function) - Optional - Called with the error on failure; when omitted, the error is logged via `console.error`. ### Behavior 1. Calls `waitForVar('AppleID')` — polls for the global `AppleID` object (default poll: 1000 ms × 100 retries). 2. In the resolution handler: if `!window.AppleID`, logs `console.error(new Error('Error loading apple script'))`. The subsequent `window.AppleID.auth.init(authOptions)` then throws a `TypeError`, which is caught by the chain's outer `.catch`. 3. Calls `window.AppleID.auth.init(authOptions)` then `const signInPromise = window.AppleID.auth.signIn();`. 4. **Redirect mode** (`!authOptions.usePopup`): the SDK navigates the page away; `onSuccess`/`onError` are popup-only by design. If `signInPromise` has a `.catch` function, a rejection is swallowed (`signInPromise.catch(() => {})`) to avoid unhandled-promise warnings during navigation. Returns `null` immediately. 5. **Popup mode** (`usePopup: true`): returns `signInPromise.then(onSuccess → response).catch(onError/console.error → null)`. On success, resolves with the raw Apple response; on failure, resolves `null`. 6. Any error from earlier steps (init throwing, waitForVar failure) is handled by the chain's outer `.catch`: `onError(err)` if provided, else `console.error(err)`; resolves `null`. ### Return value `Promise` (Flow). Note this is a **nullable-payload promise that never rejects**: - `usePopup: true` + success → resolves with the `AppleAuthResponse` object (the value resolved by `window.AppleID.auth.signIn()`). - `usePopup: true` + error → resolves `null` (after `onError`/`console.error`). - `usePopup: false` (redirect) → resolves `null` immediately. - Apple script never loaded → resolves `null` (after `console.error('Error loading apple script')` and the init `TypeError`). - `waitForVar` giving up (AppleID never appears) also results in the `Error loading apple script` path → resolves `null`. The signature return type `Promise` permits `undefined` and `null`; in practice the tests observe `null` (`appleAuthHelpers.test.js` asserts `response` to be `null` in every failure path). The TS declaration narrows it to `Promise`. ### Notes on the response's `user` object The README documents that the response contains the `user` object **only on the first** sign-in attempt for a given account; subsequent attempts return only `authorization`. ``` -------------------------------- ### Module graph Source: https://github.com/a-tokyo/react-apple-signin-auth/blob/main/_autodocs/index.md A textual module dependency graph showing the relationships between the entry point, the default AppleSigninButton component, the named useScript hook, and the appleAuthHelpers module, including their imports and dependencies. ```text src/index.js (entry, re-exports) ├── default AppleSigninButton │ └── src/AppleSigninButton/AppleSigninButton.jsx │ ├── import useScript → src/hooks/useScript.js │ ├── import appleAuthHelpers → src/appleAuthHelpers/index.js │ └── import type { AppleAuthOptions } → src/types.js ├── named useScript │ └── src/hooks/useScript.js (uses React useEffect) └── named appleAuthHelpers └── src/appleAuthHelpers/index.js ├── import waitForVar → src/utils/waitForVar.js └── import type { AppleAuthOptions, AppleAuthResponse } → src/types.js ``` -------------------------------- ### appleAuthHelpers.signIn Source: https://github.com/a-tokyo/react-apple-signin-auth/blob/main/README.md Raw JavaScript helper to perform Apple sign-in without the React component. ```APIDOC ## [FUNCTION] appleAuthHelpers.signIn ### Description Performs Apple sign-in operation without requiring the React UI. Works with any frontend JS framework. Requires the Apple script to be loaded separately. ### Parameters - **authOptions** (object) - Required - Configuration for AppleID.auth.init(). Contains clientId, scope, redirectURI, state, nonce, and usePopup. - **onSuccess** (function) - Optional - Called upon sign-in success. - **onError** (function) - Optional - Called upon sign-in error. ### Returns - If called without onSuccess, returns a Promise that resolves with the response on success or undefined on error (only works with usePopup: true). ### Usage Example ```js import { appleAuthHelpers } from 'react-apple-signin-auth'; // Callback style appleAuthHelpers.signIn({ authOptions: { clientId: 'com.example.web', scope: 'email name', redirectURI: 'https://example.com', state: 'state', nonce: 'nonce', usePopup: true, }, onSuccess: (response) => console.log(response), onError: (error) => console.error(error), }); // Promise style (only with usePopup: true) const response = await appleAuthHelpers.signIn({ authOptions: { clientId: 'com.example.web', scope: 'email name', redirectURI: 'https://example.com', state: 'state', nonce: 'nonce', usePopup: true, }, onError: (error) => console.error(error), }); if (response) { console.log(response); } else { console.error('Error performing apple signin.'); } ``` ``` -------------------------------- ### appleAuthHelpers.signIn(props) Source: https://github.com/a-tokyo/react-apple-signin-auth/blob/main/_autodocs/types.md A helper function that initiates the Apple sign-in flow with the provided properties. It returns a Promise that resolves to an AppleAuthResponse object or null. ```APIDOC ## appleAuthHelpers.signIn(props) ### Description A helper function that initiates the Apple sign-in flow with the provided properties. It returns a Promise that resolves to an AppleAuthResponse object or null. ### Method signIn ### Parameters - **props** (SignInProps) - Required - The properties for the sign-in operation. ### Returns Promise ``` -------------------------------- ### Basic usage with appleAuthHelpers.APPLE_SCRIPT_SRC Source: https://github.com/a-tokyo/react-apple-signin-auth/blob/main/_autodocs/api-reference/use-script.md Loads the Apple script using the exported constant. This is the README pattern for using useScript in a component. ```jsx import { useScript, appleAuthHelpers } from 'react-apple-signin-auth'; const myComponent = () => { useScript(appleAuthHelpers.APPLE_SCRIPT_SRC); // ... return
…
; }; export default myComponent; ``` -------------------------------- ### waitForVar usage inside the library Source: https://github.com/a-tokyo/react-apple-signin-auth/blob/main/_autodocs/api-reference/wait-for-var.md The usage inside the library: waits for the AppleID global once the script has initialized it. ```javascript waitForVar('AppleID') // -> Promise resolving to the AppleID global once the script has initialized it ``` -------------------------------- ### useScript Source: https://github.com/a-tokyo/react-apple-signin-auth/blob/main/_autodocs/index.md React hook for loading external scripts, used internally to load Apple's authentication script. ```APIDOC ## useScript ### Description React hook for loading external scripts, used internally to load Apple's authentication script. ### Import ```js import { useScript } from 'react-apple-signin-auth' ``` ### Source `src/hooks/useScript.js` ### Kind React hook ``` -------------------------------- ### AppleSignin Component Source: https://github.com/a-tokyo/react-apple-signin-auth/blob/main/README.md React component for Apple Sign-in button with configurable auth options and callbacks. ```APIDOC ## [COMPONENT] AppleSignin ### Description A React component that renders an Apple Sign-in button. It initializes AppleID.auth with the provided authOptions and handles the sign-in flow, including success and error callbacks. ### Props - **authOptions** (object) - Required - Configuration for AppleID.auth.init(). Contains clientId, scope, redirectURI, state, nonce, and usePopup. - **uiType** (string) - Optional - UI style variant (e.g., 'dark'). - **className** (string) - Optional - CSS class for the button. - **noDefaultStyle** (boolean) - Optional - If true, removes default styles. - **buttonExtraChildren** (ReactNode) - Optional - Additional content inside the button. - **onSuccess** (function) - Optional - Called upon sign-in success when usePopup is true. - **onError** (function) - Optional - Called upon sign-in error. - **skipScript** (boolean) - Optional - If true, skips loading the Apple script. - **iconProp** (object) - Optional - Props for the Apple icon, e.g., style. - **render** (function) - Optional - Custom render function that receives all props. ### Usage Example ```jsx import AppleSignin from 'react-apple-signin-auth'; const MyAppleSigninButton = () => ( console.log(response)} onError={(error) => console.error(error)} skipScript={false} iconProp={{ style: { marginTop: '10px' } }} render={(props) => } /> ); ``` ``` -------------------------------- ### appleAuthHelpers Source: https://github.com/a-tokyo/react-apple-signin-auth/blob/main/_autodocs/index.md Namespace object containing APPLE_SCRIPT_SRC and signIn helper functions for Apple authentication. ```APIDOC ## appleAuthHelpers ### Description Namespace object with helpers for Apple authentication, including the Apple script source and sign-in function. ### Import ```js import { appleAuthHelpers } from 'react-apple-signin-auth' ``` ### Source `src/appleAuthHelpers/index.js` ### Members - `APPLE_SCRIPT_SRC` - The source URL for Apple's authentication script. - `signIn` - Function to initiate sign-in with Apple. ``` -------------------------------- ### AppleSignInButton Props Source: https://github.com/a-tokyo/react-apple-signin-auth/blob/main/_autodocs/api-reference/apple-signin-button.md Lists all props accepted by the AppleSignInButton component, their types, defaults, and descriptions. ```APIDOC ## AppleSignInButton Props ### Description This component renders an Apple sign-in button. It accepts the following props to configure authentication options, callbacks, and appearance. ### Parameters | Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | `authOptions` | `AppleAuthOptions` | **yes** (de-facto: no default; passed straight to `AppleID.auth.init()`) | — | Client ID, scope, redirectURI, optional state/nonce/usePopup. See [configuration.md](../configuration.md). | | `onSuccess` | `Function` | no (default `undefined`) | — | Called with the Apple response, only when `authOptions.usePopup === true` (client-side auth). | | `onError` | `Function` | no (default `undefined`) | — | Called with the error on sign-in failure. | | `skipScript` | `boolean` | no | `false` | When `true`, the Apple script is not loaded (`useScript(null)`). | | `iconProps` | `Object` | no (Flow type is non-optional but destructured without default) | `undefined` | Spread onto the inline `` element (`width="24px" height="44px" viewBox="0 0 24 44"`). | | `render` | `Function` | no | — | Render function called with the computed button props `{ children, onClick, ...rest }`; its return value replaces the default `
…
; }; ``` -------------------------------- ### AppleSigninButton Source: https://github.com/a-tokyo/react-apple-signin-auth/blob/main/_autodocs/index.md React component that renders a Sign in with Apple button and drives the AppleID.auth API. It is the default export of the package. ```APIDOC ## AppleSigninButton ### Description React component that renders a Sign in with Apple button and drives the AppleID.auth API. It is the default export of the package. ### Import ```js import AppleSignin from 'react-apple-signin-auth' ``` ### Source `src/AppleSigninButton/AppleSigninButton.jsx` ### Kind React component (default export) ``` -------------------------------- ### SignInProps Source: https://github.com/a-tokyo/react-apple-signin-auth/blob/main/_autodocs/types.md Input type for the appleAuthHelpers.signIn method. It contains authentication options and optional callbacks. ```APIDOC ## SignInProps ### Description Input type for the `appleAuthHelpers.signIn` method. It contains authentication options and optional callbacks. ### Type Definition ```ts export type SignInProps = { authOptions: AppleAuthOptions; onSuccess?: Function; onError?: Function; }; ``` ### Fields - **authOptions** (`AppleAuthOptions`) - Required - Auth config passed to `AppleID.auth.init()`. - **onSuccess** (`Function`) - Optional - Popup-only success callback. - **onError** (`Function`) - Optional - Error callback; errors are `console.error`-logged when omitted. ### Usage Accepted by `appleAuthHelpers.signIn(props: SignInProps): Promise`. ``` -------------------------------- ### Deep subpath import for appleAuthHelpers (unstable) Source: https://github.com/a-tokyo/react-apple-signin-auth/blob/main/_autodocs/index.md Imports the appleAuthHelpers namespace from the dist subpath. The README marks this import as @unstable and warns it might change with upgrades. ```javascript import appleAuthHelpers from 'react-apple-signin-auth/dist/appleAuthHelpers'; // @unstable - might change with upgrades ``` -------------------------------- ### Catch errors from appleAuthHelpers.signIn with onError callback Source: https://github.com/a-tokyo/react-apple-signin-auth/blob/main/_autodocs/errors.md Use this pattern to handle errors from appleAuthHelpers.signIn in consumer code. Because signIn never rejects, try/catch around await will not catch Apple/script errors; instead, use the onError callback or inspect the resolved value. The onError callback receives errors from the Apple SDK and missing-script TypeErrors, and a null response indicates either the error path ran or redirect mode (usePopup: false) was used. ```javascript import { appleAuthHelpers } from 'react-apple-signin-auth'; const response = await appleAuthHelpers.signIn({ authOptions: { clientId: 'com.example.web', scope: 'email name', redirectURI: 'https://example.com', usePopup: true }, onError: (error) => { // 1) Errors from the Apple SDK and missing-script TypeErrors land here. // For case 1 note: the 'Error loading apple script' message is only console.error-ed, // not re-thrown — onError receives the TypeError thrown by the subsequent // window.AppleID.auth.init(authOptions) call instead. console.error('Sign in with Apple failed:', error); }, }); if (response) { console.log(response.authorization.id_token); } else { // 2) null here means: error path above ran, OR redirect mode (usePopup: false) was used, // in which case onError may legitimately never fire. console.log('No response — check onError output or redirect flow.'); } ``` -------------------------------- ### SignInProps type definition Source: https://github.com/a-tokyo/react-apple-signin-auth/blob/main/_autodocs/types.md Input type for appleAuthHelpers.signIn. Contains authOptions of type AppleAuthOptions, and optional onSuccess and onError callbacks. Errors are console.error-logged when onError is omitted. ```typescript export type SignInProps = { authOptions: AppleAuthOptions; onSuccess?: Function; onError?: Function; }; ``` -------------------------------- ### AppleAuthOptions TypeScript type definition Source: https://github.com/a-tokyo/react-apple-signin-auth/blob/main/_autodocs/types.md Defines the AppleAuthOptions type used for configuring Apple Sign-In authentication. It includes required fields clientId, scope, and redirectURI, with optional state, nonce, and usePopup. The redirectURI must be a registered URI and the calling page must be listed as a redirectURI; localhost fails. ```typescript export type AppleAuthOptions = { /** Client ID - eg: 'com.example.com' */ clientId: string; /** Requested scopes, seperated by spaces - eg: 'email name' */ scope: string; /** Apple's redirectURI - must be one of the URIs you added to the serviceID - the undocumented trick in apple docs is that you should call auth from a page that is listed as a redirectURI, localhost fails */ redirectURI: string; /** State string that is returned with the apple response */ state?: string; /** Nonce */ nonce?: string; /** Uses popup auth instead of redirection */ usePopup?: boolean; }; ``` -------------------------------- ### Default export shape of appleAuthHelpers Source: https://github.com/a-tokyo/react-apple-signin-auth/blob/main/_autodocs/api-reference/apple-auth-helpers.md Shows the default export object containing APPLE_SCRIPT_SRC and signIn. This is the raw namespace for Apple ID sign-in without UI. ```javascript export default { APPLE_SCRIPT_SRC, signIn, }; ``` -------------------------------- ### AppleSigninButton Component Source: https://github.com/a-tokyo/react-apple-signin-auth/blob/main/_autodocs/api-reference/apple-signin-button.md The AppleSigninButton component renders a sign-in button for Apple ID. It returns JSX, either the result of a custom render function or a default button with an Apple logo and optional default styles. It handles the sign-in flow via appleAuthHelpers.signIn on click. ```APIDOC ## AppleSigninButton Component ### Description The AppleSigninButton component renders a sign-in button for Apple ID. It returns JSX, either the result of a custom render function or a default button with an Apple logo and optional default styles. It handles the sign-in flow via appleAuthHelpers.signIn on click. ### Return Value Returns JSX: either the result of `render(props)` when `render` is provided, or a fragment `<>