1import { AuthError } from './Errors'; 2import { TokenResponse } from './TokenRequest'; 3 4// @needsAudit 5export type AuthSessionOptions = { 6 /** 7 * The URL that points to the sign in page that you would like to open the user to. 8 */ 9 authUrl: string; 10 /** 11 * The URL to return to the application. In managed apps, it's optional and defaults to output of [`Linking.createURL('expo-auth-session', params)`](./linking/#linkingcreateurlpath-namedparameters) 12 * call with `scheme` and `queryParams` params. However, in the bare app, it's required - `AuthSession` needs to know where to wait for the response. 13 * Hence, this method will throw an exception, if you don't provide `returnUrl`. 14 */ 15 returnUrl?: string; 16 /** 17 * A boolean determining whether browsed website should be shown as separate entry in Android recents/multitasking view. 18 * @default false 19 * @platform android 20 */ 21 showInRecents?: boolean; 22 /** 23 * Project name to use for the `auth.expo.io` proxy. 24 */ 25 projectNameForProxy?: string; 26}; 27 28// @needsAudit 29/** 30 * Object returned after an auth request has completed. 31 * - If the user cancelled the authentication session by closing the browser, the result is `{ type: 'cancel' }`. 32 * - If the authentication is dismissed manually with `AuthSession.dismiss()`, the result is `{ type: 'dismiss' }`. 33 * - If the authentication flow is successful, the result is `{ type: 'success', params: Object, event: Object }`. 34 * - If the authentication flow is returns an error, the result is `{ type: 'error', params: Object, error: string, event: Object }`. 35 * - If you call `AuthSession.startAsync()` more than once before the first call has returned, the result is `{ type: 'locked' }`, 36 * because only one `AuthSession` can be in progress at any time. 37 */ 38export type AuthSessionResult = 39 | { 40 /** 41 * How the auth completed. 42 */ 43 type: 'cancel' | 'dismiss' | 'opened' | 'locked'; 44 } 45 | { 46 /** 47 * How the auth completed. 48 */ 49 type: 'error' | 'success'; 50 /** 51 * @deprecated Legacy error code query param, use `error` instead. 52 */ 53 errorCode: string | null; 54 /** 55 * Possible error if the auth failed with type `error`. 56 */ 57 error?: AuthError | null; 58 /** 59 * Query params from the `url` as an object. 60 */ 61 params: Record<string, string>; 62 /** 63 * Returned when the auth finishes with an `access_token` property. 64 */ 65 authentication: TokenResponse | null; 66 /** 67 * Auth URL that was opened 68 */ 69 url: string; 70 }; 71 72// @needsAudit 73/** 74 * Options passed to `makeRedirectUri`. 75 */ 76export type AuthSessionRedirectUriOptions = { 77 /** 78 * Optional path to append to a URI. This will not be added to `native`. 79 */ 80 path?: string; 81 /** 82 * URI protocol `<scheme>://` that must be built into your native app. 83 */ 84 scheme?: string; 85 /** 86 * Optional native scheme 87 * URI protocol `<scheme>://` that must be built into your native app. 88 */ 89 queryParams?: Record<string, string | undefined>; 90 /** 91 * Should the URI be triple slashed `scheme:///path` or double slashed `scheme://path`. 92 * Defaults to `false`. 93 */ 94 isTripleSlashed?: boolean; 95 /** 96 * Attempt to convert the Expo server IP address to localhost. 97 * This is useful for testing when your IP changes often, this will only work for iOS simulator. 98 * 99 * @default false 100 */ 101 preferLocalhost?: boolean; 102 /** 103 * Manual scheme to use in Bare and Standalone native app contexts. Takes precedence over all other properties. 104 * You must define the URI scheme that will be used in a custom built native application or standalone Expo application. 105 * The value should conform to your native app's URI schemes. 106 * You can see conformance with `npx uri-scheme list`. 107 */ 108 native?: string; 109}; 110