1import { AuthError } from './Errors';
2import { TokenResponse } from './TokenRequest';
3
4export type AuthSessionOptions = {
5  authUrl: string;
6  returnUrl?: string;
7  showInRecents?: boolean;
8};
9
10export type AuthSessionResult =
11  | { type: 'cancel' | 'dismiss' | 'locked' }
12  | {
13      type: 'error' | 'success';
14      errorCode: string | null;
15      error?: AuthError | null;
16      params: { [key: string]: string };
17      authentication: TokenResponse | null;
18      url: string;
19    };
20
21/**
22 * Options passed to `makeRedirectUriAsync`.
23 */
24export type AuthSessionRedirectUriOptions = {
25  /**
26   * Optional path to append to a URI. This will not be added to `native`.
27   */
28  path?: string;
29  /**
30   * URI protocol `<scheme>://` that must be built into your native app.
31   * Passed to `Linking.createURL()` when `useProxy` is `false`.
32   */
33  scheme?: string;
34  /**
35   * Optional native scheme to use when proxy is disabled.
36   * URI protocol `<scheme>://` that must be built into your native app.
37   * Passed to `Linking.createURL()` when `useProxy` is `false`.
38   */
39  queryParams?: Record<string, string | undefined>;
40  /**
41   * Should the URI be triple slashed `scheme:///path` or double slashed `scheme://path`.
42   * Defaults to `false`.
43   * Passed to `Linking.createURL()` when `useProxy` is `false`.
44   */
45  isTripleSlashed?: boolean;
46  /**
47   * Should use the \`auth.expo.io\` proxy.
48   * This is useful for testing managed native apps that require a custom URI scheme.
49   *
50   * @default false
51   */
52  useProxy?: boolean;
53  /**
54   * Attempt to convert the Expo server IP address to localhost.
55   * This is useful for testing when your IP changes often, this will only work for iOS simulator.
56   *
57   * @default false
58   */
59  preferLocalhost?: boolean;
60  /**
61   * Manual scheme to use in Bare and Standalone native app contexts.
62   * Takes precedence over all other properties.
63   * You must define the URI scheme that will be used in a custom built native application or standalone Expo application.
64   * The value should conform to your native app's URI schemes.
65   * You can see conformance with:
66   *
67   * `npx uri-scheme list`
68   *
69   */
70  native?: string;
71};
72