expo-auth-session 3.7.0 → 3.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/build/AuthRequest.types.d.ts +2 -2
- package/build/AuthRequest.types.js.map +1 -1
- package/build/AuthSession.d.ts +3 -3
- package/build/AuthSession.js +3 -3
- package/build/AuthSession.js.map +1 -1
- package/build/AuthSession.types.d.ts +2 -2
- package/build/AuthSession.types.js.map +1 -1
- package/build/SessionUrlProvider.d.ts.map +1 -1
- package/build/SessionUrlProvider.js +2 -7
- package/build/SessionUrlProvider.js.map +1 -1
- package/build/providers/Facebook.d.ts.map +1 -1
- package/build/providers/Facebook.js +1 -0
- package/build/providers/Facebook.js.map +1 -1
- package/build/providers/Google.d.ts +1 -1
- package/build/providers/Google.js.map +1 -1
- package/package.json +6 -6
- package/src/AuthRequest.types.ts +2 -2
- package/src/AuthSession.ts +3 -3
- package/src/AuthSession.types.ts +2 -2
- package/src/SessionUrlProvider.ts +1 -5
- package/src/providers/Facebook.ts +1 -0
- package/src/providers/Google.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,16 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 3.7.2 — 2022-10-25
|
|
14
|
+
|
|
15
|
+
### 💡 Others
|
|
16
|
+
|
|
17
|
+
- Update docs to remove mentions of `expo start:web`. ([#18419](https://github.com/expo/expo/pull/18419) by [@EvanBacon](https://github.com/EvanBacon))
|
|
18
|
+
|
|
19
|
+
## 3.7.1 — 2022-07-16
|
|
20
|
+
|
|
21
|
+
_This version does not introduce any user-facing changes._
|
|
22
|
+
|
|
13
23
|
## 3.7.0 — 2022-07-07
|
|
14
24
|
|
|
15
25
|
### 🎉 New features
|
|
@@ -77,7 +77,7 @@ export declare type AuthRequestPromptOptions = Omit<WebBrowserOpenOptions, 'wind
|
|
|
77
77
|
*/
|
|
78
78
|
useProxy?: boolean;
|
|
79
79
|
/**
|
|
80
|
-
* Project name to use for the
|
|
80
|
+
* Project name to use for the `auth.expo.io` proxy when `useProxy` is `true`.
|
|
81
81
|
*/
|
|
82
82
|
projectNameForProxy?: string;
|
|
83
83
|
/**
|
|
@@ -116,7 +116,7 @@ export interface AuthRequestConfig {
|
|
|
116
116
|
clientId: string;
|
|
117
117
|
/**
|
|
118
118
|
* After completing an interaction with a resource owner the
|
|
119
|
-
* server will redirect to this URI. Learn more about [linking in Expo](
|
|
119
|
+
* server will redirect to this URI. Learn more about [linking in Expo](/guides/linking/).
|
|
120
120
|
*
|
|
121
121
|
* [Section 3.1.2](https://tools.ietf.org/html/rfc6749#section-3.1.2)
|
|
122
122
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthRequest.types.js","sourceRoot":"","sources":["../src/AuthRequest.types.ts"],"names":[],"mappings":"AAGA,cAAc;AACd,MAAM,CAAN,IAAY,mBAYX;AAZD,WAAY,mBAAmB;IAC7B;;;;;OAKG;IACH,oCAAa,CAAA;IACb;;OAEG;IACH,sCAAe,CAAA;AACjB,CAAC,EAZW,mBAAmB,KAAnB,mBAAmB,QAY9B;AAED,cAAc;AACd;;;;GAIG;AACH,MAAM,CAAN,IAAY,YAaX;AAbD,WAAY,YAAY;IACtB;;OAEG;IACH,6BAAa,CAAA;IACb;;OAEG;IACH,+BAAe,CAAA;IACf;;OAEG;IACH,oCAAoB,CAAA;AACtB,CAAC,EAbW,YAAY,KAAZ,YAAY,QAavB;AAED,cAAc;AACd;;;;;;GAMG;AACH,MAAM,CAAN,IAAY,MAsBX;AAtBD,WAAY,MAAM;IAChB;;;;OAIG;IACH,uBAAa,CAAA;IACb;;;OAGG;IACH,yBAAe,CAAA;IACf;;;OAGG;IACH,6BAAmB,CAAA;IACnB;;;OAGG;IACH,0CAAgC,CAAA;AAClC,CAAC,EAtBW,MAAM,KAAN,MAAM,QAsBjB","sourcesContent":["import { CreateURLOptions } from 'expo-linking';\nimport { WebBrowserOpenOptions, WebBrowserWindowFeatures } from 'expo-web-browser';\n\n// @needsAudit\nexport enum CodeChallengeMethod {\n /**\n * The default and recommended method for transforming the code verifier.\n * - Convert the code verifier to ASCII.\n * - Create a digest of the string using crypto method SHA256.\n * - Convert the digest to Base64 and URL encode it.\n */\n S256 = 'S256',\n /**\n * This should not be used. When used, the code verifier will be sent to the server as-is.\n */\n Plain = 'plain',\n}\n\n// @needsAudit\n/**\n * The client informs the authorization server of the desired grant type by using the response type.\n *\n * @see [Section 3.1.1](https://tools.ietf.org/html/rfc6749#section-3.1.1).\n */\nexport enum ResponseType {\n /**\n * For requesting an authorization code as described by [Section 4.1.1](https://tools.ietf.org/html/rfc6749#section-4.1.1).\n */\n Code = 'code',\n /**\n * For requesting an access token (implicit grant) as described by [Section 4.2.1](https://tools.ietf.org/html/rfc6749#section-4.2.1).\n */\n Token = 'token',\n /**\n * A custom registered type for getting an `id_token` from Google OAuth.\n */\n IdToken = 'id_token',\n}\n\n// @needsAudit\n/**\n * Informs the server if the user should be prompted to login or consent again.\n * This can be used to present a dialog for switching accounts after the user has already been logged in.\n * You should use this in favor of clearing cookies (which is mostly not possible on iOS).\n *\n * @see [Section 3.1.2.1](https://openid.net/specs/openid-connect-core-1_0.html#AuthorizationRequest).\n */\nexport enum Prompt {\n /**\n * Server must not display any auth or consent UI. Can be used to check for existing auth or consent.\n * An error is returned if a user isn't already authenticated or the client doesn't have pre-configured consent for the requested claims, or does not fulfill other conditions for processing the request.\n * The error code will typically be `login_required`, `interaction_required`, or another code defined in [Section 3.1.2.6](https://openid.net/specs/openid-connect-core-1_0.html#AuthError).\n */\n None = 'none',\n /**\n * The server should prompt the user to reauthenticate.\n * If it cannot reauthenticate the End-User, it must return an error, typically `login_required`.\n */\n Login = 'login',\n /**\n * Server should prompt the user for consent before returning information to the client.\n * If it cannot obtain consent, it must return an error, typically `consent_required`.\n */\n Consent = 'consent',\n /**\n * Server should prompt the user to select an account. Can be used to switch accounts.\n * If it can't obtain an account selection choice made by the user, it must return an error, typically `account_selection_required`.\n */\n SelectAccount = 'select_account',\n}\n\n// @needsAudit\n/**\n * Options passed to the `promptAsync()` method of `AuthRequest`s.\n * This can be used to configure how the web browser should look and behave.\n */\nexport type AuthRequestPromptOptions = Omit<WebBrowserOpenOptions, 'windowFeatures'> & {\n /**\n * URL to open when prompting the user. This usually should be defined internally and left `undefined` in most cases.\n */\n url?: string;\n /**\n * Should the authentication request use the Expo proxy service `auth.expo.io`.\n * @default false\n */\n useProxy?: boolean;\n /**\n * Project name to use for the
|
|
1
|
+
{"version":3,"file":"AuthRequest.types.js","sourceRoot":"","sources":["../src/AuthRequest.types.ts"],"names":[],"mappings":"AAGA,cAAc;AACd,MAAM,CAAN,IAAY,mBAYX;AAZD,WAAY,mBAAmB;IAC7B;;;;;OAKG;IACH,oCAAa,CAAA;IACb;;OAEG;IACH,sCAAe,CAAA;AACjB,CAAC,EAZW,mBAAmB,KAAnB,mBAAmB,QAY9B;AAED,cAAc;AACd;;;;GAIG;AACH,MAAM,CAAN,IAAY,YAaX;AAbD,WAAY,YAAY;IACtB;;OAEG;IACH,6BAAa,CAAA;IACb;;OAEG;IACH,+BAAe,CAAA;IACf;;OAEG;IACH,oCAAoB,CAAA;AACtB,CAAC,EAbW,YAAY,KAAZ,YAAY,QAavB;AAED,cAAc;AACd;;;;;;GAMG;AACH,MAAM,CAAN,IAAY,MAsBX;AAtBD,WAAY,MAAM;IAChB;;;;OAIG;IACH,uBAAa,CAAA;IACb;;;OAGG;IACH,yBAAe,CAAA;IACf;;;OAGG;IACH,6BAAmB,CAAA;IACnB;;;OAGG;IACH,0CAAgC,CAAA;AAClC,CAAC,EAtBW,MAAM,KAAN,MAAM,QAsBjB","sourcesContent":["import { CreateURLOptions } from 'expo-linking';\nimport { WebBrowserOpenOptions, WebBrowserWindowFeatures } from 'expo-web-browser';\n\n// @needsAudit\nexport enum CodeChallengeMethod {\n /**\n * The default and recommended method for transforming the code verifier.\n * - Convert the code verifier to ASCII.\n * - Create a digest of the string using crypto method SHA256.\n * - Convert the digest to Base64 and URL encode it.\n */\n S256 = 'S256',\n /**\n * This should not be used. When used, the code verifier will be sent to the server as-is.\n */\n Plain = 'plain',\n}\n\n// @needsAudit\n/**\n * The client informs the authorization server of the desired grant type by using the response type.\n *\n * @see [Section 3.1.1](https://tools.ietf.org/html/rfc6749#section-3.1.1).\n */\nexport enum ResponseType {\n /**\n * For requesting an authorization code as described by [Section 4.1.1](https://tools.ietf.org/html/rfc6749#section-4.1.1).\n */\n Code = 'code',\n /**\n * For requesting an access token (implicit grant) as described by [Section 4.2.1](https://tools.ietf.org/html/rfc6749#section-4.2.1).\n */\n Token = 'token',\n /**\n * A custom registered type for getting an `id_token` from Google OAuth.\n */\n IdToken = 'id_token',\n}\n\n// @needsAudit\n/**\n * Informs the server if the user should be prompted to login or consent again.\n * This can be used to present a dialog for switching accounts after the user has already been logged in.\n * You should use this in favor of clearing cookies (which is mostly not possible on iOS).\n *\n * @see [Section 3.1.2.1](https://openid.net/specs/openid-connect-core-1_0.html#AuthorizationRequest).\n */\nexport enum Prompt {\n /**\n * Server must not display any auth or consent UI. Can be used to check for existing auth or consent.\n * An error is returned if a user isn't already authenticated or the client doesn't have pre-configured consent for the requested claims, or does not fulfill other conditions for processing the request.\n * The error code will typically be `login_required`, `interaction_required`, or another code defined in [Section 3.1.2.6](https://openid.net/specs/openid-connect-core-1_0.html#AuthError).\n */\n None = 'none',\n /**\n * The server should prompt the user to reauthenticate.\n * If it cannot reauthenticate the End-User, it must return an error, typically `login_required`.\n */\n Login = 'login',\n /**\n * Server should prompt the user for consent before returning information to the client.\n * If it cannot obtain consent, it must return an error, typically `consent_required`.\n */\n Consent = 'consent',\n /**\n * Server should prompt the user to select an account. Can be used to switch accounts.\n * If it can't obtain an account selection choice made by the user, it must return an error, typically `account_selection_required`.\n */\n SelectAccount = 'select_account',\n}\n\n// @needsAudit\n/**\n * Options passed to the `promptAsync()` method of `AuthRequest`s.\n * This can be used to configure how the web browser should look and behave.\n */\nexport type AuthRequestPromptOptions = Omit<WebBrowserOpenOptions, 'windowFeatures'> & {\n /**\n * URL to open when prompting the user. This usually should be defined internally and left `undefined` in most cases.\n */\n url?: string;\n /**\n * Should the authentication request use the Expo proxy service `auth.expo.io`.\n * @default false\n */\n useProxy?: boolean;\n /**\n * Project name to use for the `auth.expo.io` proxy when `useProxy` is `true`.\n */\n projectNameForProxy?: string;\n /**\n * URL options to be used when creating the redirect URL for the auth proxy.\n */\n proxyOptions?: Omit<CreateURLOptions, 'queryParams'> & { path?: string };\n /**\n * Features to use with `window.open()`.\n * @platform web\n */\n windowFeatures?: WebBrowserWindowFeatures;\n};\n\n// @needsAudit\n/**\n * Represents an OAuth authorization request as JSON.\n */\nexport interface AuthRequestConfig {\n /**\n * Specifies what is returned from the authorization server.\n *\n * [Section 3.1.1](https://tools.ietf.org/html/rfc6749#section-3.1.1)\n *\n * @default ResponseType.Code\n */\n responseType?: ResponseType | string;\n /**\n * A unique string representing the registration information provided by the client.\n * The client identifier is not a secret; it is exposed to the resource owner and shouldn't be used\n * alone for client authentication.\n *\n * The client identifier is unique to the authorization server.\n *\n * [Section 2.2](https://tools.ietf.org/html/rfc6749#section-2.2)\n */\n clientId: string;\n /**\n * After completing an interaction with a resource owner the\n * server will redirect to this URI. Learn more about [linking in Expo](/guides/linking/).\n *\n * [Section 3.1.2](https://tools.ietf.org/html/rfc6749#section-3.1.2)\n */\n redirectUri: string;\n /**\n * List of strings to request access to.\n *\n * [Section 3.3](https://tools.ietf.org/html/rfc6749#section-3.3)\n */\n scopes?: string[];\n /**\n * Client secret supplied by an auth provider.\n * There is no secure way to store this on the client.\n *\n * [Section 2.3.1](https://tools.ietf.org/html/rfc6749#section-2.3.1)\n */\n clientSecret?: string;\n /**\n * Method used to generate the code challenge. You should never use `Plain` as it's not good enough for secure verification.\n * @default CodeChallengeMethod.S256\n */\n codeChallengeMethod?: CodeChallengeMethod;\n /**\n * Derived from the code verifier by using the `CodeChallengeMethod`.\n *\n * [Section 4.2](https://tools.ietf.org/html/rfc7636#section-4.2)\n */\n codeChallenge?: string;\n /**\n * Informs the server if the user should be prompted to login or consent again.\n * This can be used to present a dialog for switching accounts after the user has already been logged in.\n *\n * [Section 3.1.2.1](https://openid.net/specs/openid-connect-core-1_0.html#AuthorizationRequest)\n */\n prompt?: Prompt;\n /**\n * Used for protection against [Cross-Site Request Forgery](https://tools.ietf.org/html/rfc6749#section-10.12).\n */\n state?: string;\n /**\n * Extra query params that'll be added to the query string.\n */\n extraParams?: Record<string, string>;\n /**\n * Should use [Proof Key for Code Exchange](https://oauth.net/2/pkce/).\n * @default true\n */\n usePKCE?: boolean;\n}\n"]}
|
package/build/AuthSession.d.ts
CHANGED
|
@@ -53,7 +53,7 @@ export declare function getRedirectUrl(path?: string): string;
|
|
|
53
53
|
* scheme: 'my-scheme',
|
|
54
54
|
* path: 'redirect'
|
|
55
55
|
* });
|
|
56
|
-
* //
|
|
56
|
+
* // Development Build: my-scheme://redirect
|
|
57
57
|
* // Expo Go: exp://127.0.0.1:19000/--/redirect
|
|
58
58
|
* // Web dev: https://localhost:19006/redirect
|
|
59
59
|
* // Web prod: https://yourwebsite.com/redirect
|
|
@@ -63,7 +63,7 @@ export declare function getRedirectUrl(path?: string): string;
|
|
|
63
63
|
* preferLocalhost: true,
|
|
64
64
|
* isTripleSlashed: true,
|
|
65
65
|
* });
|
|
66
|
-
* //
|
|
66
|
+
* // Development Build: scheme2:///
|
|
67
67
|
* // Expo Go: exp://localhost:19000
|
|
68
68
|
* // Web dev: https://localhost:19006
|
|
69
69
|
* // Web prod: https://yourwebsite.com
|
|
@@ -71,7 +71,7 @@ export declare function getRedirectUrl(path?: string): string;
|
|
|
71
71
|
* const redirectUri3 = makeRedirectUri({
|
|
72
72
|
* useProxy: true,
|
|
73
73
|
* });
|
|
74
|
-
* //
|
|
74
|
+
* // Development Build: https://auth.expo.io/@username/slug
|
|
75
75
|
* // Expo Go: https://auth.expo.io/@username/slug
|
|
76
76
|
* // Web dev: https://localhost:19006
|
|
77
77
|
* // Web prod: https://yourwebsite.com
|
package/build/AuthSession.js
CHANGED
|
@@ -113,7 +113,7 @@ export function getRedirectUrl(path) {
|
|
|
113
113
|
* scheme: 'my-scheme',
|
|
114
114
|
* path: 'redirect'
|
|
115
115
|
* });
|
|
116
|
-
* //
|
|
116
|
+
* // Development Build: my-scheme://redirect
|
|
117
117
|
* // Expo Go: exp://127.0.0.1:19000/--/redirect
|
|
118
118
|
* // Web dev: https://localhost:19006/redirect
|
|
119
119
|
* // Web prod: https://yourwebsite.com/redirect
|
|
@@ -123,7 +123,7 @@ export function getRedirectUrl(path) {
|
|
|
123
123
|
* preferLocalhost: true,
|
|
124
124
|
* isTripleSlashed: true,
|
|
125
125
|
* });
|
|
126
|
-
* //
|
|
126
|
+
* // Development Build: scheme2:///
|
|
127
127
|
* // Expo Go: exp://localhost:19000
|
|
128
128
|
* // Web dev: https://localhost:19006
|
|
129
129
|
* // Web prod: https://yourwebsite.com
|
|
@@ -131,7 +131,7 @@ export function getRedirectUrl(path) {
|
|
|
131
131
|
* const redirectUri3 = makeRedirectUri({
|
|
132
132
|
* useProxy: true,
|
|
133
133
|
* });
|
|
134
|
-
* //
|
|
134
|
+
* // Development Build: https://auth.expo.io/@username/slug
|
|
135
135
|
* // Expo Go: https://auth.expo.io/@username/slug
|
|
136
136
|
* // Web dev: https://localhost:19006
|
|
137
137
|
* // Web prod: https://yourwebsite.com
|
package/build/AuthSession.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthSession.js","sourceRoot":"","sources":["../src/AuthSession.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,EAAE,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EACL,kBAAkB,EAClB,oBAAoB,G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AAE,aAAa,EAAE,CAAC,CAAC;IAClF,IAAI,MAAM,CAAC,IAAI,KAAK,QAAQ,IAAI,MAAM,CAAC,IAAI,KAAK,SAAS,EAAE;QACzD,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;KAC9B;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEjD,OAAO,EAIL,WAAW,EAGX,mBAAmB,EAInB,MAAM,EAEN,YAAY,EACZ,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,GACvB,CAAC;AAEF,OAAO;AACL,gBAAgB;AAChB,aAAa,EACb,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB;AAClB,gBAAgB;AAChB,WAAW,EACX,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,gBAAgB,CAAC;AAExB,cAAc;AACd,cAAc,sBAAsB,CAAC","sourcesContent":["import Constants, { ExecutionEnvironment } from 'expo-constants';\nimport * as Linking from 'expo-linking';\nimport { Platform } from 'expo-modules-core';\nimport {\n dismissAuthSession,\n openAuthSessionAsync,\n WebBrowserAuthSessionResult,\n} from 'expo-web-browser';\n\nimport { AuthRequest } from './AuthRequest';\nimport {\n AuthRequestConfig,\n AuthRequestPromptOptions,\n CodeChallengeMethod,\n Prompt,\n ResponseType,\n} from './AuthRequest.types';\nimport {\n AuthSessionOptions,\n AuthSessionRedirectUriOptions,\n AuthSessionResult,\n} from './AuthSession.types';\nimport {\n DiscoveryDocument,\n fetchDiscoveryAsync,\n Issuer,\n IssuerOrDiscovery,\n ProviderMetadata,\n resolveDiscoveryAsync,\n} from './Discovery';\nimport { generateHexStringAsync } from './PKCE';\nimport { getQueryParams } from './QueryParams';\nimport sessionUrlProvider from './SessionUrlProvider';\n\nlet _authLock = false;\n\n// @needsAudit\n/**\n * Initiate a proxied authentication session with the given options. Only one `AuthSession` can be active at any given time in your application.\n * If you attempt to open a second session while one is still in progress, the second session will return a value to indicate that `AuthSession` is locked.\n *\n * @param options An object of type `AuthSessionOptions`.\n * @return Returns a Promise that resolves to an `AuthSessionResult` object.\n */\nexport async function startAsync(options: AuthSessionOptions): Promise<AuthSessionResult> {\n const authUrl = options.authUrl;\n // Prevent accidentally starting to an empty url\n if (!authUrl) {\n throw new Error(\n 'No authUrl provided to AuthSession.startAsync. An authUrl is required -- it points to the page where the user will be able to sign in.'\n );\n }\n // Prevent multiple sessions from running at the same time, WebBrowser doesn't\n // support it this makes the behavior predictable.\n if (_authLock) {\n if (__DEV__) {\n console.warn(\n 'Attempted to call AuthSession.startAsync multiple times while already active. Only one AuthSession can be active at any given time.'\n );\n }\n\n return { type: 'locked' };\n }\n\n const returnUrl = options.returnUrl || sessionUrlProvider.getDefaultReturnUrl();\n const startUrl = sessionUrlProvider.getStartUrl(authUrl, returnUrl, options.projectNameForProxy);\n const showInRecents = options.showInRecents || false;\n\n // About to start session, set lock\n _authLock = true;\n\n let result: WebBrowserAuthSessionResult;\n try {\n result = await _openWebBrowserAsync(startUrl, returnUrl, showInRecents);\n } finally {\n // WebBrowser session complete, unset lock\n _authLock = false;\n }\n\n // Handle failures\n if (!result) {\n throw new Error('Unexpected missing AuthSession result');\n }\n if (!('url' in result)) {\n if ('type' in result) {\n return result;\n } else {\n throw new Error('Unexpected AuthSession result with missing type');\n }\n }\n\n const { params, errorCode } = getQueryParams(result.url);\n\n return {\n type: errorCode ? 'error' : 'success',\n params,\n errorCode,\n authentication: null,\n url: result.url,\n };\n}\n\n// @needsAudit\n/**\n * Cancels an active `AuthSession` if there is one. No return value, but if there is an active `AuthSession`\n * then the Promise returned by the `AuthSession.startAsync()` that initiated it resolves to `{ type: 'dismiss' }`.\n */\nexport function dismiss() {\n dismissAuthSession();\n}\n\nexport const getDefaultReturnUrl = sessionUrlProvider.getDefaultReturnUrl;\n\n// @needsAudit @docsMissing\n/**\n * Get the URL that your authentication provider needs to redirect to. For example: `https://auth.expo.io/@your-username/your-app-slug`. You can pass an additional path component to be appended to the default redirect URL.\n * > **Note** This method will throw an exception if you're using the bare workflow on native.\n *\n * @param path\n * @return\n *\n * @example\n * ```ts\n * const url = AuthSession.getRedirectUrl('redirect');\n *\n * // Managed: https://auth.expo.io/@your-username/your-app-slug/redirect\n * // Web: https://localhost:19006/redirect\n * ```\n *\n * @deprecated Use `makeRedirectUri({ path, useProxy })` instead.\n */\nexport function getRedirectUrl(path?: string): string {\n return sessionUrlProvider.getRedirectUrl({ urlPath: path });\n}\n\n// @needsAudit\n/**\n * Create a redirect url for the current platform and environment. You need to manually define the redirect that will be used in\n * a bare workflow React Native app, or an Expo standalone app, this is because it cannot be inferred automatically.\n * - **Web:** Generates a path based on the current `window.location`. For production web apps, you should hard code the URL as well.\n * - **Managed workflow:** Uses the `scheme` property of your `app.config.js` or `app.json`.\n * - **Proxy:** Uses `auth.expo.io` as the base URL for the path. This only works in Expo Go and standalone environments.\n * - **Bare workflow:** Will fallback to using the `native` option for bare workflow React Native apps.\n *\n * @param options Additional options for configuring the path.\n * @return The `redirectUri` to use in an authentication request.\n *\n * @example\n * ```ts\n * const redirectUri = makeRedirectUri({\n * scheme: 'my-scheme',\n * path: 'redirect'\n * });\n * // Custom app: my-scheme://redirect\n * // Expo Go: exp://127.0.0.1:19000/--/redirect\n * // Web dev: https://localhost:19006/redirect\n * // Web prod: https://yourwebsite.com/redirect\n *\n * const redirectUri2 = makeRedirectUri({\n * scheme: 'scheme2',\n * preferLocalhost: true,\n * isTripleSlashed: true,\n * });\n * // Custom app: scheme2:///\n * // Expo Go: exp://localhost:19000\n * // Web dev: https://localhost:19006\n * // Web prod: https://yourwebsite.com\n *\n * const redirectUri3 = makeRedirectUri({\n * useProxy: true,\n * });\n * // Custom app: https://auth.expo.io/@username/slug\n * // Expo Go: https://auth.expo.io/@username/slug\n * // Web dev: https://localhost:19006\n * // Web prod: https://yourwebsite.com\n * ```\n */\nexport function makeRedirectUri({\n native,\n scheme,\n isTripleSlashed,\n queryParams,\n path,\n preferLocalhost,\n useProxy,\n projectNameForProxy,\n}: AuthSessionRedirectUriOptions = {}): string {\n if (\n Platform.OS !== 'web' &&\n native &&\n [ExecutionEnvironment.Standalone, ExecutionEnvironment.Bare].includes(\n Constants.executionEnvironment\n )\n ) {\n // Should use the user-defined native scheme in standalone builds\n return native;\n }\n if (!useProxy || Platform.OS === 'web') {\n const url = Linking.createURL(path || '', {\n isTripleSlashed,\n scheme,\n queryParams,\n });\n\n if (preferLocalhost) {\n const ipAddress = url.match(\n /\\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b/\n );\n // Only replace if an IP address exists\n if (ipAddress?.length) {\n const [protocol, path] = url.split(ipAddress[0]);\n return `${protocol}localhost${path}`;\n }\n }\n\n return url;\n }\n // Attempt to use the proxy\n return sessionUrlProvider.getRedirectUrl({ urlPath: path, projectNameForProxy });\n}\n\n// @needsAudit\n/**\n * Build an `AuthRequest` and load it before returning.\n *\n * @param config A valid [`AuthRequestConfig`](#authrequestconfig) that specifies what provider to use.\n * @param issuerOrDiscovery A loaded [`DiscoveryDocument`](#discoverydocument) or issuer URL.\n * (Only `authorizationEndpoint` is required for requesting an authorization code).\n * @return Returns an instance of `AuthRequest` that can be used to prompt the user for authorization.\n */\nexport async function loadAsync(\n config: AuthRequestConfig,\n issuerOrDiscovery: IssuerOrDiscovery\n): Promise<AuthRequest> {\n const request = new AuthRequest(config);\n const discovery = await resolveDiscoveryAsync(issuerOrDiscovery);\n await request.makeAuthUrlAsync(discovery);\n return request;\n}\n\nasync function _openWebBrowserAsync(startUrl: string, returnUrl: string, showInRecents: boolean) {\n const result = await openAuthSessionAsync(startUrl, returnUrl, { showInRecents });\n if (result.type === 'cancel' || result.type === 'dismiss') {\n return { type: result.type };\n }\n\n return result;\n}\n\nexport { useAutoDiscovery, useAuthRequest } from './AuthRequestHooks';\nexport { AuthError, TokenError } from './Errors';\n\nexport {\n AuthSessionOptions,\n AuthSessionRedirectUriOptions,\n AuthSessionResult,\n AuthRequest,\n AuthRequestConfig,\n AuthRequestPromptOptions,\n CodeChallengeMethod,\n DiscoveryDocument,\n Issuer,\n IssuerOrDiscovery,\n Prompt,\n ProviderMetadata,\n ResponseType,\n resolveDiscoveryAsync,\n fetchDiscoveryAsync,\n generateHexStringAsync,\n};\n\nexport {\n // Token classes\n TokenResponse,\n AccessTokenRequest,\n RefreshTokenRequest,\n RevokeTokenRequest,\n // Token methods\n revokeAsync,\n refreshAsync,\n exchangeCodeAsync,\n fetchUserInfoAsync,\n} from './TokenRequest';\n\n// Token types\nexport * from './TokenRequest.types';\n\n// Provider specific types\nexport { GoogleAuthRequestConfig } from './providers/Google';\nexport { FacebookAuthRequestConfig } from './providers/Facebook';\n"]}
|
|
1
|
+
{"version":3,"file":"AuthSession.js","sourceRoot":"","sources":["../src/AuthSession.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,EAAE,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EACL,kBAAkB,EAClB,oBAAoB,GAErB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAGL,mBAAmB,EACnB,MAAM,EACN,YAAY,GACb,MAAM,qBAAqB,CAAC;AAM7B,OAAO,EAEL,mBAAmB,EAInB,qBAAqB,GACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,sBAAsB,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,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SAAS,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEjD,OAAO,EAIL,WAAW,EAGX,mBAAmB,EAInB,MAAM,EAEN,YAAY,EACZ,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,GACvB,CAAC;AAEF,OAAO;AACL,gBAAgB;AAChB,aAAa,EACb,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB;AAClB,gBAAgB;AAChB,WAAW,EACX,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,gBAAgB,CAAC;AAExB,cAAc;AACd,cAAc,sBAAsB,CAAC","sourcesContent":["import Constants, { ExecutionEnvironment } from 'expo-constants';\nimport * as Linking from 'expo-linking';\nimport { Platform } from 'expo-modules-core';\nimport {\n dismissAuthSession,\n openAuthSessionAsync,\n WebBrowserAuthSessionResult,\n} from 'expo-web-browser';\n\nimport { AuthRequest } from './AuthRequest';\nimport {\n AuthRequestConfig,\n AuthRequestPromptOptions,\n CodeChallengeMethod,\n Prompt,\n ResponseType,\n} from './AuthRequest.types';\nimport {\n AuthSessionOptions,\n AuthSessionRedirectUriOptions,\n AuthSessionResult,\n} from './AuthSession.types';\nimport {\n DiscoveryDocument,\n fetchDiscoveryAsync,\n Issuer,\n IssuerOrDiscovery,\n ProviderMetadata,\n resolveDiscoveryAsync,\n} from './Discovery';\nimport { generateHexStringAsync } from './PKCE';\nimport { getQueryParams } from './QueryParams';\nimport sessionUrlProvider from './SessionUrlProvider';\n\nlet _authLock = false;\n\n// @needsAudit\n/**\n * Initiate a proxied authentication session with the given options. Only one `AuthSession` can be active at any given time in your application.\n * If you attempt to open a second session while one is still in progress, the second session will return a value to indicate that `AuthSession` is locked.\n *\n * @param options An object of type `AuthSessionOptions`.\n * @return Returns a Promise that resolves to an `AuthSessionResult` object.\n */\nexport async function startAsync(options: AuthSessionOptions): Promise<AuthSessionResult> {\n const authUrl = options.authUrl;\n // Prevent accidentally starting to an empty url\n if (!authUrl) {\n throw new Error(\n 'No authUrl provided to AuthSession.startAsync. An authUrl is required -- it points to the page where the user will be able to sign in.'\n );\n }\n // Prevent multiple sessions from running at the same time, WebBrowser doesn't\n // support it this makes the behavior predictable.\n if (_authLock) {\n if (__DEV__) {\n console.warn(\n 'Attempted to call AuthSession.startAsync multiple times while already active. Only one AuthSession can be active at any given time.'\n );\n }\n\n return { type: 'locked' };\n }\n\n const returnUrl = options.returnUrl || sessionUrlProvider.getDefaultReturnUrl();\n const startUrl = sessionUrlProvider.getStartUrl(authUrl, returnUrl, options.projectNameForProxy);\n const showInRecents = options.showInRecents || false;\n\n // About to start session, set lock\n _authLock = true;\n\n let result: WebBrowserAuthSessionResult;\n try {\n result = await _openWebBrowserAsync(startUrl, returnUrl, showInRecents);\n } finally {\n // WebBrowser session complete, unset lock\n _authLock = false;\n }\n\n // Handle failures\n if (!result) {\n throw new Error('Unexpected missing AuthSession result');\n }\n if (!('url' in result)) {\n if ('type' in result) {\n return result;\n } else {\n throw new Error('Unexpected AuthSession result with missing type');\n }\n }\n\n const { params, errorCode } = getQueryParams(result.url);\n\n return {\n type: errorCode ? 'error' : 'success',\n params,\n errorCode,\n authentication: null,\n url: result.url,\n };\n}\n\n// @needsAudit\n/**\n * Cancels an active `AuthSession` if there is one. No return value, but if there is an active `AuthSession`\n * then the Promise returned by the `AuthSession.startAsync()` that initiated it resolves to `{ type: 'dismiss' }`.\n */\nexport function dismiss() {\n dismissAuthSession();\n}\n\nexport const getDefaultReturnUrl = sessionUrlProvider.getDefaultReturnUrl;\n\n// @needsAudit @docsMissing\n/**\n * Get the URL that your authentication provider needs to redirect to. For example: `https://auth.expo.io/@your-username/your-app-slug`. You can pass an additional path component to be appended to the default redirect URL.\n * > **Note** This method will throw an exception if you're using the bare workflow on native.\n *\n * @param path\n * @return\n *\n * @example\n * ```ts\n * const url = AuthSession.getRedirectUrl('redirect');\n *\n * // Managed: https://auth.expo.io/@your-username/your-app-slug/redirect\n * // Web: https://localhost:19006/redirect\n * ```\n *\n * @deprecated Use `makeRedirectUri({ path, useProxy })` instead.\n */\nexport function getRedirectUrl(path?: string): string {\n return sessionUrlProvider.getRedirectUrl({ urlPath: path });\n}\n\n// @needsAudit\n/**\n * Create a redirect url for the current platform and environment. You need to manually define the redirect that will be used in\n * a bare workflow React Native app, or an Expo standalone app, this is because it cannot be inferred automatically.\n * - **Web:** Generates a path based on the current `window.location`. For production web apps, you should hard code the URL as well.\n * - **Managed workflow:** Uses the `scheme` property of your `app.config.js` or `app.json`.\n * - **Proxy:** Uses `auth.expo.io` as the base URL for the path. This only works in Expo Go and standalone environments.\n * - **Bare workflow:** Will fallback to using the `native` option for bare workflow React Native apps.\n *\n * @param options Additional options for configuring the path.\n * @return The `redirectUri` to use in an authentication request.\n *\n * @example\n * ```ts\n * const redirectUri = makeRedirectUri({\n * scheme: 'my-scheme',\n * path: 'redirect'\n * });\n * // Development Build: my-scheme://redirect\n * // Expo Go: exp://127.0.0.1:19000/--/redirect\n * // Web dev: https://localhost:19006/redirect\n * // Web prod: https://yourwebsite.com/redirect\n *\n * const redirectUri2 = makeRedirectUri({\n * scheme: 'scheme2',\n * preferLocalhost: true,\n * isTripleSlashed: true,\n * });\n * // Development Build: scheme2:///\n * // Expo Go: exp://localhost:19000\n * // Web dev: https://localhost:19006\n * // Web prod: https://yourwebsite.com\n *\n * const redirectUri3 = makeRedirectUri({\n * useProxy: true,\n * });\n * // Development Build: https://auth.expo.io/@username/slug\n * // Expo Go: https://auth.expo.io/@username/slug\n * // Web dev: https://localhost:19006\n * // Web prod: https://yourwebsite.com\n * ```\n */\nexport function makeRedirectUri({\n native,\n scheme,\n isTripleSlashed,\n queryParams,\n path,\n preferLocalhost,\n useProxy,\n projectNameForProxy,\n}: AuthSessionRedirectUriOptions = {}): string {\n if (\n Platform.OS !== 'web' &&\n native &&\n [ExecutionEnvironment.Standalone, ExecutionEnvironment.Bare].includes(\n Constants.executionEnvironment\n )\n ) {\n // Should use the user-defined native scheme in standalone builds\n return native;\n }\n if (!useProxy || Platform.OS === 'web') {\n const url = Linking.createURL(path || '', {\n isTripleSlashed,\n scheme,\n queryParams,\n });\n\n if (preferLocalhost) {\n const ipAddress = url.match(\n /\\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b/\n );\n // Only replace if an IP address exists\n if (ipAddress?.length) {\n const [protocol, path] = url.split(ipAddress[0]);\n return `${protocol}localhost${path}`;\n }\n }\n\n return url;\n }\n // Attempt to use the proxy\n return sessionUrlProvider.getRedirectUrl({ urlPath: path, projectNameForProxy });\n}\n\n// @needsAudit\n/**\n * Build an `AuthRequest` and load it before returning.\n *\n * @param config A valid [`AuthRequestConfig`](#authrequestconfig) that specifies what provider to use.\n * @param issuerOrDiscovery A loaded [`DiscoveryDocument`](#discoverydocument) or issuer URL.\n * (Only `authorizationEndpoint` is required for requesting an authorization code).\n * @return Returns an instance of `AuthRequest` that can be used to prompt the user for authorization.\n */\nexport async function loadAsync(\n config: AuthRequestConfig,\n issuerOrDiscovery: IssuerOrDiscovery\n): Promise<AuthRequest> {\n const request = new AuthRequest(config);\n const discovery = await resolveDiscoveryAsync(issuerOrDiscovery);\n await request.makeAuthUrlAsync(discovery);\n return request;\n}\n\nasync function _openWebBrowserAsync(startUrl: string, returnUrl: string, showInRecents: boolean) {\n const result = await openAuthSessionAsync(startUrl, returnUrl, { showInRecents });\n if (result.type === 'cancel' || result.type === 'dismiss') {\n return { type: result.type };\n }\n\n return result;\n}\n\nexport { useAutoDiscovery, useAuthRequest } from './AuthRequestHooks';\nexport { AuthError, TokenError } from './Errors';\n\nexport {\n AuthSessionOptions,\n AuthSessionRedirectUriOptions,\n AuthSessionResult,\n AuthRequest,\n AuthRequestConfig,\n AuthRequestPromptOptions,\n CodeChallengeMethod,\n DiscoveryDocument,\n Issuer,\n IssuerOrDiscovery,\n Prompt,\n ProviderMetadata,\n ResponseType,\n resolveDiscoveryAsync,\n fetchDiscoveryAsync,\n generateHexStringAsync,\n};\n\nexport {\n // Token classes\n TokenResponse,\n AccessTokenRequest,\n RefreshTokenRequest,\n RevokeTokenRequest,\n // Token methods\n revokeAsync,\n refreshAsync,\n exchangeCodeAsync,\n fetchUserInfoAsync,\n} from './TokenRequest';\n\n// Token types\nexport * from './TokenRequest.types';\n\n// Provider specific types\nexport { GoogleAuthRequestConfig } from './providers/Google';\nexport { FacebookAuthRequestConfig } from './providers/Facebook';\n"]}
|
|
@@ -18,7 +18,7 @@ export declare type AuthSessionOptions = {
|
|
|
18
18
|
*/
|
|
19
19
|
showInRecents?: boolean;
|
|
20
20
|
/**
|
|
21
|
-
* Project name to use for the
|
|
21
|
+
* Project name to use for the `auth.expo.io` proxy.
|
|
22
22
|
*/
|
|
23
23
|
projectNameForProxy?: string;
|
|
24
24
|
};
|
|
@@ -95,7 +95,7 @@ export declare type AuthSessionRedirectUriOptions = {
|
|
|
95
95
|
*/
|
|
96
96
|
useProxy?: boolean;
|
|
97
97
|
/**
|
|
98
|
-
* Project name to use for the
|
|
98
|
+
* Project name to use for the `auth.expo.io` proxy when `useProxy` is `true`.
|
|
99
99
|
*/
|
|
100
100
|
projectNameForProxy?: string;
|
|
101
101
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthSession.types.js","sourceRoot":"","sources":["../src/AuthSession.types.ts"],"names":[],"mappings":"","sourcesContent":["import { AuthError } from './Errors';\nimport { TokenResponse } from './TokenRequest';\n\n// @needsAudit\nexport type AuthSessionOptions = {\n /**\n * The URL that points to the sign in page that you would like to open the user to.\n */\n authUrl: string;\n /**\n * 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)\n * call with `scheme` and `queryParams` params. However, in the bare app, it's required - `AuthSession` needs to know where to wait for the response.\n * Hence, this method will throw an exception, if you don't provide `returnUrl`.\n */\n returnUrl?: string;\n /**\n * A boolean determining whether browsed website should be shown as separate entry in Android recents/multitasking view.\n * @default false\n * @platform android\n */\n showInRecents?: boolean;\n /**\n * Project name to use for the
|
|
1
|
+
{"version":3,"file":"AuthSession.types.js","sourceRoot":"","sources":["../src/AuthSession.types.ts"],"names":[],"mappings":"","sourcesContent":["import { AuthError } from './Errors';\nimport { TokenResponse } from './TokenRequest';\n\n// @needsAudit\nexport type AuthSessionOptions = {\n /**\n * The URL that points to the sign in page that you would like to open the user to.\n */\n authUrl: string;\n /**\n * 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)\n * call with `scheme` and `queryParams` params. However, in the bare app, it's required - `AuthSession` needs to know where to wait for the response.\n * Hence, this method will throw an exception, if you don't provide `returnUrl`.\n */\n returnUrl?: string;\n /**\n * A boolean determining whether browsed website should be shown as separate entry in Android recents/multitasking view.\n * @default false\n * @platform android\n */\n showInRecents?: boolean;\n /**\n * Project name to use for the `auth.expo.io` proxy.\n */\n projectNameForProxy?: string;\n};\n\n// @needsAudit\n/**\n * Object returned after an auth request has completed.\n * - If the user cancelled the authentication session by closing the browser, the result is `{ type: 'cancel' }`.\n * - If the authentication is dismissed manually with `AuthSession.dismiss()`, the result is `{ type: 'dismiss' }`.\n * - If the authentication flow is successful, the result is `{ type: 'success', params: Object, event: Object }`.\n * - If the authentication flow is returns an error, the result is `{ type: 'error', params: Object, error: string, event: Object }`.\n * - If you call `AuthSession.startAsync()` more than once before the first call has returned, the result is `{ type: 'locked' }`,\n * because only one `AuthSession` can be in progress at any time.\n */\nexport type AuthSessionResult =\n | {\n /**\n * How the auth completed.\n */\n type: 'cancel' | 'dismiss' | 'opened' | 'locked';\n }\n | {\n /**\n * How the auth completed.\n */\n type: 'error' | 'success';\n /**\n * @deprecated Legacy error code query param, use `error` instead.\n */\n errorCode: string | null;\n /**\n * Possible error if the auth failed with type `error`.\n */\n error?: AuthError | null;\n /**\n * Query params from the `url` as an object.\n */\n params: Record<string, string>;\n /**\n * Returned when the auth finishes with an `access_token` property.\n */\n authentication: TokenResponse | null;\n /**\n * Auth URL that was opened\n */\n url: string;\n };\n\n// @needsAudit\n/**\n * Options passed to `makeRedirectUriAsync`.\n */\nexport type AuthSessionRedirectUriOptions = {\n /**\n * Optional path to append to a URI. This will not be added to `native`.\n */\n path?: string;\n /**\n * URI protocol `<scheme>://` that must be built into your native app.\n * Passed to `Linking.createURL()` when `useProxy` is `false`.\n */\n scheme?: string;\n /**\n * Optional native scheme to use when proxy is disabled.\n * URI protocol `<scheme>://` that must be built into your native app.\n * Passed to `Linking.createURL()` when `useProxy` is `false`.\n */\n queryParams?: Record<string, string | undefined>;\n /**\n * Should the URI be triple slashed `scheme:///path` or double slashed `scheme://path`.\n * Defaults to `false`.\n * Passed to `Linking.createURL()` when `useProxy` is `false`.\n */\n isTripleSlashed?: boolean;\n /**\n * Should use the \\`auth.expo.io\\` proxy.\n * This is useful for testing managed native apps that require a custom URI scheme.\n *\n * @default false\n */\n useProxy?: boolean;\n /**\n * Project name to use for the `auth.expo.io` proxy when `useProxy` is `true`.\n */\n projectNameForProxy?: string;\n /**\n * Attempt to convert the Expo server IP address to localhost.\n * This is useful for testing when your IP changes often, this will only work for iOS simulator.\n *\n * @default false\n */\n preferLocalhost?: boolean;\n /**\n * Manual scheme to use in Bare and Standalone native app contexts. Takes precedence over all other properties.\n * You must define the URI scheme that will be used in a custom built native application or standalone Expo application.\n * The value should conform to your native app's URI schemes.\n * You can see conformance with `npx uri-scheme list`.\n */\n native?: string;\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionUrlProvider.d.ts","sourceRoot":"","sources":["../src/SessionUrlProvider.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AAIxC,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,Q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;CAGlC;;AAED,wBAAwC"}
|
|
@@ -40,8 +40,7 @@ export class SessionUrlProvider {
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
const legacyExpoProjectFullName = options.projectNameForProxy ||
|
|
43
|
-
Constants.
|
|
44
|
-
Constants.manifest2?.extra?.expoClient?.originalFullName ||
|
|
43
|
+
Constants.expoConfig?.originalFullName ||
|
|
45
44
|
Constants.manifest?.id;
|
|
46
45
|
if (!legacyExpoProjectFullName) {
|
|
47
46
|
let nextSteps = '';
|
|
@@ -70,11 +69,7 @@ export class SessionUrlProvider {
|
|
|
70
69
|
return redirectUrl;
|
|
71
70
|
}
|
|
72
71
|
static getHostAddressQueryParams() {
|
|
73
|
-
let hostUri =
|
|
74
|
-
// @ts-ignore: hostUri isn't defined on the expoClient type, because
|
|
75
|
-
// Constants.manifest is of type AppManifest while
|
|
76
|
-
// Constants.manifest2.extra.expoClient is of type ExpoConfig
|
|
77
|
-
Constants.manifest?.hostUri ?? Constants.manifest2?.extra?.expoClient?.hostUri;
|
|
72
|
+
let hostUri = Constants.manifest?.hostUri ?? Constants.manifest2?.extra?.expoClient?.hostUri;
|
|
78
73
|
if (!hostUri &&
|
|
79
74
|
(ExecutionEnvironment.StoreClient === Constants.executionEnvironment ||
|
|
80
75
|
Linking.resolveScheme({}))) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionUrlProvider.js","sourceRoot":"","sources":["../src/SessionUrlProvider.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,EAAE,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAgB,MAAM,IAAI,CAAC;AAElC,MAAM,OAAO,kBAAkB;IACrB,MAAM,CAAU,QAAQ,GAAG,sBAAsB,CAAC;IAClD,MAAM,CAAU,YAAY,GAAG,mBAAm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D,CAAC;IAEO,MAAM,CAAC,kBAAkB,CAAC,GAAW;QAC3C,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAChC,CAAC;;AAGH,eAAe,IAAI,kBAAkB,EAAE,CAAC","sourcesContent":["import Constants, { ExecutionEnvironment } from 'expo-constants';\nimport * as Linking from 'expo-linking';\nimport { Platform } from 'expo-modules-core';\nimport qs, { ParsedQs } from 'qs';\n\nexport class SessionUrlProvider {\n private static readonly BASE_URL = `https://auth.expo.io`;\n private static readonly SESSION_PATH = 'expo-auth-session';\n\n getDefaultReturnUrl(\n urlPath?: string,\n options?: Omit<Linking.CreateURLOptions, 'queryParams'>\n ): string {\n const queryParams = SessionUrlProvider.getHostAddressQueryParams();\n let path = SessionUrlProvider.SESSION_PATH;\n if (urlPath) {\n path = [path, SessionUrlProvider.removeLeadingSlash(urlPath)].filter(Boolean).join('/');\n }\n\n return Linking.createURL(path, {\n // The redirect URL doesn't matter for the proxy as long as it's valid, so silence warnings if needed.\n scheme: options?.scheme ?? Linking.resolveScheme({ isSilent: true }),\n queryParams,\n isTripleSlashed: options?.isTripleSlashed,\n });\n }\n\n getStartUrl(authUrl: string, returnUrl: string, projectNameForProxy: string | undefined): string {\n if (Platform.OS === 'web' && !Platform.isDOMAvailable) {\n // Return nothing in SSR envs\n return '';\n }\n const queryString = qs.stringify({\n authUrl,\n returnUrl,\n });\n\n return `${this.getRedirectUrl({ projectNameForProxy })}/start?${queryString}`;\n }\n\n getRedirectUrl(options: { projectNameForProxy?: string; urlPath?: string }): string {\n if (Platform.OS === 'web') {\n if (Platform.isDOMAvailable) {\n return [window.location.origin, options.urlPath].filter(Boolean).join('/');\n } else {\n // Return nothing in SSR envs\n return '';\n }\n }\n\n const legacyExpoProjectFullName =\n options.projectNameForProxy ||\n Constants.expoConfig?.originalFullName ||\n Constants.manifest?.id;\n\n if (!legacyExpoProjectFullName) {\n let nextSteps = '';\n if (__DEV__) {\n if (Constants.executionEnvironment === ExecutionEnvironment.Bare) {\n nextSteps =\n ' Please ensure you have the latest version of expo-constants installed and rebuild your native app. You can verify that originalFullName is defined by running `expo config --type public` and inspecting the output.';\n } else if (Constants.executionEnvironment === ExecutionEnvironment.StoreClient) {\n nextSteps =\n ' Please report this as a bug with the contents of `expo config --type public`.';\n }\n }\n\n if (Constants.manifest2) {\n nextSteps =\n ' Prefer AuthRequest (with the useProxy option set to false) in combination with an Expo Development Client build of your application.' +\n ' To continue using the AuthSession proxy, specify the project full name (@owner/slug) using the projectNameForProxy option.';\n }\n\n throw new Error(\n 'Cannot use the AuthSession proxy because the project full name is not defined.' + nextSteps\n );\n }\n\n const redirectUrl = `${SessionUrlProvider.BASE_URL}/${legacyExpoProjectFullName}`;\n if (__DEV__) {\n SessionUrlProvider.warnIfAnonymous(legacyExpoProjectFullName, redirectUrl);\n // TODO: Verify with the dev server that the manifest is up to date.\n }\n return redirectUrl;\n }\n\n private static getHostAddressQueryParams(): ParsedQs | undefined {\n let hostUri: string | undefined =\n Constants.manifest?.hostUri ?? Constants.manifest2?.extra?.expoClient?.hostUri;\n if (\n !hostUri &&\n (ExecutionEnvironment.StoreClient === Constants.executionEnvironment ||\n Linking.resolveScheme({}))\n ) {\n if (!Constants.linkingUri) {\n hostUri = '';\n } else {\n // we're probably not using up-to-date xdl, so just fake it for now\n // we have to remove the /--/ on the end since this will be inserted again later\n hostUri = SessionUrlProvider.removeScheme(Constants.linkingUri).replace(/\\/--(\\/.*)?$/, '');\n }\n }\n\n if (!hostUri) {\n return undefined;\n }\n\n const uriParts = hostUri?.split('?');\n try {\n return qs.parse(uriParts?.[1]);\n } catch {}\n\n return undefined;\n }\n\n private static warnIfAnonymous(id, url): void {\n if (id.startsWith('@anonymous/')) {\n console.warn(\n `You are not currently signed in to Expo on your development machine. As a result, the redirect URL for AuthSession will be \"${url}\". If you are using an OAuth provider that requires adding redirect URLs to an allow list, we recommend that you do not add this URL -- instead, you should sign in to Expo to acquire a unique redirect URL. Additionally, if you do decide to publish this app using Expo, you will need to register an account to do it.`\n );\n }\n }\n\n private static removeScheme(url: string) {\n return url.replace(/^[a-zA-Z0-9+.-]+:\\/\\//, '');\n }\n\n private static removeLeadingSlash(url: string) {\n return url.replace(/^\\//, '');\n }\n}\n\nexport default new SessionUrlProvider();\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Facebook.d.ts","sourceRoot":"","sources":["../../src/providers/Facebook.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EACL,WAAW,EACX,wBAAwB,EACxB,6BAA6B,EAC7B,iBAAiB,EACjB,iBAAiB,EAGlB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAS7D,eAAO,MAAM,SAAS,EAAE,iBAGvB,CAAC;AAGF,MAAM,WAAW,yBAA0B,SAAQ,yBAAyB;IAC1E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAGD;;GAEG;AACH,cAAM,mBAAoB,SAAQ,WAAW;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;gBAEH,EACV,QAAQ,EAER,WAAgB,EAChB,YAAY,EACZ,GAAG,MAAM,EACV,EAAE,yBAAyB;IA6B5B;;OAEG;IACG,yBAAyB,IAAI,OAAO,CAAC,iBAAiB,CAAC;CAa9D;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAC5B,MAAM,GAAE,OAAO,CAAC,yBAAyB,CAAM,EAC/C,kBAAkB,GAAE,OAAO,CAAC,6BAA6B,CAAM,GAC9D;IACD,mBAAmB,GAAG,IAAI;IAC1B,iBAAiB,GAAG,IAAI;IACxB,CAAC,OAAO,CAAC,EAAE,wBAAwB,KAAK,OAAO,CAAC,iBAAiB,CAAC;CACnE,
|
|
1
|
+
{"version":3,"file":"Facebook.d.ts","sourceRoot":"","sources":["../../src/providers/Facebook.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EACL,WAAW,EACX,wBAAwB,EACxB,6BAA6B,EAC7B,iBAAiB,EACjB,iBAAiB,EAGlB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAS7D,eAAO,MAAM,SAAS,EAAE,iBAGvB,CAAC;AAGF,MAAM,WAAW,yBAA0B,SAAQ,yBAAyB;IAC1E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAGD;;GAEG;AACH,cAAM,mBAAoB,SAAQ,WAAW;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;gBAEH,EACV,QAAQ,EAER,WAAgB,EAChB,YAAY,EACZ,GAAG,MAAM,EACV,EAAE,yBAAyB;IA6B5B;;OAEG;IACG,yBAAyB,IAAI,OAAO,CAAC,iBAAiB,CAAC;CAa9D;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAC5B,MAAM,GAAE,OAAO,CAAC,yBAAyB,CAAM,EAC/C,kBAAkB,GAAE,OAAO,CAAC,6BAA6B,CAAM,GAC9D;IACD,mBAAmB,GAAG,IAAI;IAC1B,iBAAiB,GAAG,IAAI;IACxB,CAAC,OAAO,CAAC,EAAE,wBAAwB,KAAK,OAAO,CAAC,iBAAiB,CAAC;CACnE,CA6DA"}
|
|
@@ -102,6 +102,7 @@ export function useAuthRequest(config = {}, redirectUriOptions = {}) {
|
|
|
102
102
|
// The redirect URI should be created using fb + client ID on native.
|
|
103
103
|
native: `fb${clientId}://authorize`,
|
|
104
104
|
useProxy,
|
|
105
|
+
projectNameForProxy: '@community/native-component-list',
|
|
105
106
|
...redirectUriOptions,
|
|
106
107
|
});
|
|
107
108
|
}, [useProxy, clientId, config.redirectUri, redirectUriOptions]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Facebook.js","sourceRoot":"","sources":["../../src/providers/Facebook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAGxC,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AACjF,OAAO,EACL,WAAW,EAKX,eAAe,EACf,YAAY,GACb,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEjD,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvE,MAAM,QAAQ,GAAG;IACf,cAAc,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE;IAC3C,kFAAkF;IAClF,aAAa,EAAE,CAAC,gBAAgB,EAAE,OAAO,CAAC;CAC3C,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAsB;IAC1C,qBAAqB,EAAE,4CAA4C;IACnE,aAAa,EAAE,oDAAoD;CACpE,CAAC;AAUF,cAAc;AACd;;GAEG;AACH,MAAM,mBAAoB,SAAQ,WAAW;IAC3C,KAAK,CAAU;IAEf,YAAY,EACV,QAAQ;IACR,6DAA6D;IAC7D,WAAW,GAAG,EAAE,EAChB,YAAY,EACZ,GAAG,MAAM,EACiB;QAC1B,MAAM,WAAW,GAA2B;YAC1C,OAAO,EAAE,OAAO;YAChB,GAAG,WAAW;SACf,CAAC;QACF,IAAI,QAAQ,EAAE;YACZ,WAAW,CAAC,MAAM,GAAG,QAAQ,CAAC;SAC/B;QAED,2BAA2B;QAC3B,MAAM,MAAM,GAAG,mBAAmB,CA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MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,oBAAoB,CAAC,OAAO,EAAE,SAAS,EAAE;QACrE,cAAc,EAAE,QAAQ,CAAC,cAAc;QACvC,QAAQ;KACT,CAAC,CAAC;IAEH,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;AACxC,CAAC","sourcesContent":["import { useMemo } from 'react';\nimport { Platform } from 'react-native';\n\nimport { AuthRequestConfig } from '../AuthRequest.types';\nimport { useAuthRequestResult, useLoadedAuthRequest } from '../AuthRequestHooks';\nimport {\n AuthRequest,\n AuthRequestPromptOptions,\n AuthSessionRedirectUriOptions,\n AuthSessionResult,\n DiscoveryDocument,\n makeRedirectUri,\n ResponseType,\n} from '../AuthSession';\nimport { generateHexStringAsync } from '../PKCE';\nimport { ProviderAuthRequestConfig } from './Provider.types';\nimport { applyRequiredScopes, useProxyEnabled } from './ProviderUtils';\n\nconst settings = {\n windowFeatures: { width: 700, height: 600 },\n // These are required for Firebase to work properly which is a reasonable default.\n minimumScopes: ['public_profile', 'email'],\n};\n\nexport const discovery: DiscoveryDocument = {\n authorizationEndpoint: 'https://www.facebook.com/v6.0/dialog/oauth',\n tokenEndpoint: 'https://graph.facebook.com/v6.0/oauth/access_token',\n};\n\n// @needsAudit @docsMissing\nexport interface FacebookAuthRequestConfig extends ProviderAuthRequestConfig {\n webClientId?: string;\n iosClientId?: string;\n androidClientId?: string;\n expoClientId?: string;\n}\n\n// @needsAudit\n/**\n * Extends [`AuthRequest`](#authrequest) and accepts [`FacebookAuthRequest`](#facebookauthrequest) in the constructor.\n */\nclass FacebookAuthRequest extends AuthRequest {\n nonce?: string;\n\n constructor({\n language,\n // Account selection cannot be reliably emulated on Facebook.\n extraParams = {},\n clientSecret,\n ...config\n }: FacebookAuthRequestConfig) {\n const inputParams: Record<string, string> = {\n display: 'popup',\n ...extraParams,\n };\n if (language) {\n inputParams.locale = language;\n }\n\n // Apply the default scopes\n const scopes = applyRequiredScopes(config.scopes, settings.minimumScopes);\n let inputClientSecret: string | undefined;\n // Facebook will throw if you attempt to use the client secret\n if (config.responseType && config.responseType !== ResponseType.Code) {\n // TODO: maybe warn that you shouldn't store the client secret on the client\n inputClientSecret = clientSecret;\n }\n // Default to implicit auth\n if (!config.responseType) {\n config.responseType = ResponseType.Token;\n }\n super({\n ...config,\n clientSecret: inputClientSecret,\n scopes,\n extraParams: inputParams,\n });\n }\n\n /**\n * Load and return a valid auth request based on the input config.\n */\n async getAuthRequestConfigAsync(): Promise<AuthRequestConfig> {\n const { extraParams = {}, ...config } = await super.getAuthRequestConfigAsync();\n if (!extraParams.nonce && !this.nonce) {\n if (!this.nonce) {\n this.nonce = await generateHexStringAsync(16);\n }\n extraParams.auth_nonce = this.nonce;\n }\n return {\n ...config,\n extraParams,\n };\n }\n}\n\n/**\n * Load an authorization request.\n * Returns a loaded request, a response, and a prompt method.\n * When the prompt method completes then the response will be fulfilled.\n *\n * - [Get Started](https://docs.expo.dev/guides/authentication/#facebook)\n *\n * @param config\n * @param redirectUriOptions\n */\nexport function useAuthRequest(\n config: Partial<FacebookAuthRequestConfig> = {},\n redirectUriOptions: Partial<AuthSessionRedirectUriOptions> = {}\n): [\n FacebookAuthRequest | null,\n AuthSessionResult | null,\n (options?: AuthRequestPromptOptions) => Promise<AuthSessionResult>\n] {\n const useProxy = useProxyEnabled(redirectUriOptions);\n\n const clientId = useMemo((): string => {\n const propertyName = useProxy\n ? 'expoClientId'\n : Platform.select({\n ios: 'iosClientId',\n android: 'androidClientId',\n default: 'webClientId',\n });\n return config[propertyName as any] ?? config.clientId;\n }, [\n useProxy,\n config.expoClientId,\n config.iosClientId,\n config.androidClientId,\n config.webClientId,\n config.clientId,\n ]);\n\n const redirectUri = useMemo((): string => {\n if (typeof config.redirectUri !== 'undefined') {\n return config.redirectUri;\n }\n\n return makeRedirectUri({\n // The redirect URI should be created using fb + client ID on native.\n native: `fb${clientId}://authorize`,\n useProxy,\n ...redirectUriOptions,\n });\n }, [useProxy, clientId, config.redirectUri, redirectUriOptions]);\n\n const extraParams = useMemo((): FacebookAuthRequestConfig['extraParams'] => {\n const output = config.extraParams ? { ...config.extraParams } : {};\n\n if (config.language) {\n output.locale = config.language;\n }\n return output;\n }, [config.extraParams, config.language]);\n\n const request = useLoadedAuthRequest(\n {\n ...config,\n extraParams,\n clientId,\n redirectUri,\n },\n discovery,\n FacebookAuthRequest\n );\n\n const [result, promptAsync] = useAuthRequestResult(request, discovery, {\n windowFeatures: settings.windowFeatures,\n useProxy,\n });\n\n return [request, result, promptAsync];\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Facebook.js","sourceRoot":"","sources":["../../src/providers/Facebook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAGxC,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AACjF,OAAO,EACL,WAAW,EAKX,eAAe,EACf,YAAY,GACb,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEjD,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvE,MAAM,QAAQ,GAAG;IACf,cAAc,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE;IAC3C,kFAAkF;IAClF,aAAa,EAAE,CAAC,gBAAgB,EAAE,OAAO,CAAC;CAC3C,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAsB;IAC1C,qBAAqB,EAAE,4CAA4C;IACnE,aAAa,EAAE,oDAAoD;CACpE,CAAC;AAUF,cAAc;AACd;;GAEG;AACH,MAAM,mBAAoB,SAAQ,WAAW;IAC3C,KAAK,CAAU;IAEf,YAAY,EACV,QAAQ;IACR,6DAA6D;IAC7D,WAAW,GAAG,EAAE,EAChB,YAAY,EACZ,GAA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;QACD,OAAO,MAAM,CAAC;IAChB,CAAC,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;IAE1C,MAAM,OAAO,GAAG,oBAAoB,CAClC;QACE,GAAG,MAAM;QACT,WAAW;QACX,QAAQ;QACR,WAAW;KACZ,EACD,SAAS,EACT,mBAAmB,CACpB,CAAC;IAEF,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,oBAAoB,CAAC,OAAO,EAAE,SAAS,EAAE;QACrE,cAAc,EAAE,QAAQ,CAAC,cAAc;QACvC,QAAQ;KACT,CAAC,CAAC;IAEH,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;AACxC,CAAC","sourcesContent":["import { useMemo } from 'react';\nimport { Platform } from 'react-native';\n\nimport { AuthRequestConfig } from '../AuthRequest.types';\nimport { useAuthRequestResult, useLoadedAuthRequest } from '../AuthRequestHooks';\nimport {\n AuthRequest,\n AuthRequestPromptOptions,\n AuthSessionRedirectUriOptions,\n AuthSessionResult,\n DiscoveryDocument,\n makeRedirectUri,\n ResponseType,\n} from '../AuthSession';\nimport { generateHexStringAsync } from '../PKCE';\nimport { ProviderAuthRequestConfig } from './Provider.types';\nimport { applyRequiredScopes, useProxyEnabled } from './ProviderUtils';\n\nconst settings = {\n windowFeatures: { width: 700, height: 600 },\n // These are required for Firebase to work properly which is a reasonable default.\n minimumScopes: ['public_profile', 'email'],\n};\n\nexport const discovery: DiscoveryDocument = {\n authorizationEndpoint: 'https://www.facebook.com/v6.0/dialog/oauth',\n tokenEndpoint: 'https://graph.facebook.com/v6.0/oauth/access_token',\n};\n\n// @needsAudit @docsMissing\nexport interface FacebookAuthRequestConfig extends ProviderAuthRequestConfig {\n webClientId?: string;\n iosClientId?: string;\n androidClientId?: string;\n expoClientId?: string;\n}\n\n// @needsAudit\n/**\n * Extends [`AuthRequest`](#authrequest) and accepts [`FacebookAuthRequest`](#facebookauthrequest) in the constructor.\n */\nclass FacebookAuthRequest extends AuthRequest {\n nonce?: string;\n\n constructor({\n language,\n // Account selection cannot be reliably emulated on Facebook.\n extraParams = {},\n clientSecret,\n ...config\n }: FacebookAuthRequestConfig) {\n const inputParams: Record<string, string> = {\n display: 'popup',\n ...extraParams,\n };\n if (language) {\n inputParams.locale = language;\n }\n\n // Apply the default scopes\n const scopes = applyRequiredScopes(config.scopes, settings.minimumScopes);\n let inputClientSecret: string | undefined;\n // Facebook will throw if you attempt to use the client secret\n if (config.responseType && config.responseType !== ResponseType.Code) {\n // TODO: maybe warn that you shouldn't store the client secret on the client\n inputClientSecret = clientSecret;\n }\n // Default to implicit auth\n if (!config.responseType) {\n config.responseType = ResponseType.Token;\n }\n super({\n ...config,\n clientSecret: inputClientSecret,\n scopes,\n extraParams: inputParams,\n });\n }\n\n /**\n * Load and return a valid auth request based on the input config.\n */\n async getAuthRequestConfigAsync(): Promise<AuthRequestConfig> {\n const { extraParams = {}, ...config } = await super.getAuthRequestConfigAsync();\n if (!extraParams.nonce && !this.nonce) {\n if (!this.nonce) {\n this.nonce = await generateHexStringAsync(16);\n }\n extraParams.auth_nonce = this.nonce;\n }\n return {\n ...config,\n extraParams,\n };\n }\n}\n\n/**\n * Load an authorization request.\n * Returns a loaded request, a response, and a prompt method.\n * When the prompt method completes then the response will be fulfilled.\n *\n * - [Get Started](https://docs.expo.dev/guides/authentication/#facebook)\n *\n * @param config\n * @param redirectUriOptions\n */\nexport function useAuthRequest(\n config: Partial<FacebookAuthRequestConfig> = {},\n redirectUriOptions: Partial<AuthSessionRedirectUriOptions> = {}\n): [\n FacebookAuthRequest | null,\n AuthSessionResult | null,\n (options?: AuthRequestPromptOptions) => Promise<AuthSessionResult>\n] {\n const useProxy = useProxyEnabled(redirectUriOptions);\n\n const clientId = useMemo((): string => {\n const propertyName = useProxy\n ? 'expoClientId'\n : Platform.select({\n ios: 'iosClientId',\n android: 'androidClientId',\n default: 'webClientId',\n });\n return config[propertyName as any] ?? config.clientId;\n }, [\n useProxy,\n config.expoClientId,\n config.iosClientId,\n config.androidClientId,\n config.webClientId,\n config.clientId,\n ]);\n\n const redirectUri = useMemo((): string => {\n if (typeof config.redirectUri !== 'undefined') {\n return config.redirectUri;\n }\n\n return makeRedirectUri({\n // The redirect URI should be created using fb + client ID on native.\n native: `fb${clientId}://authorize`,\n useProxy,\n projectNameForProxy: '@community/native-component-list',\n ...redirectUriOptions,\n });\n }, [useProxy, clientId, config.redirectUri, redirectUriOptions]);\n\n const extraParams = useMemo((): FacebookAuthRequestConfig['extraParams'] => {\n const output = config.extraParams ? { ...config.extraParams } : {};\n\n if (config.language) {\n output.locale = config.language;\n }\n return output;\n }, [config.extraParams, config.language]);\n\n const request = useLoadedAuthRequest(\n {\n ...config,\n extraParams,\n clientId,\n redirectUri,\n },\n discovery,\n FacebookAuthRequest\n );\n\n const [result, promptAsync] = useAuthRequestResult(request, discovery, {\n windowFeatures: settings.windowFeatures,\n useProxy,\n });\n\n return [request, result, promptAsync];\n}\n"]}
|
|
@@ -31,7 +31,7 @@ export interface GoogleAuthRequestConfig extends ProviderAuthRequestConfig {
|
|
|
31
31
|
* - Give it a name (e.g. "Web App").
|
|
32
32
|
* - **URIs** (Authorized JavaScript origins): https://localhost:19006 & https://yourwebsite.com
|
|
33
33
|
* - **Authorized redirect URIs**: https://localhost:19006 & https://yourwebsite.com
|
|
34
|
-
* - To test this be sure to start your app with `expo start
|
|
34
|
+
* - To test this be sure to start your app with `npx expo start --https`.
|
|
35
35
|
*/
|
|
36
36
|
webClientId?: string;
|
|
37
37
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Google.js","sourceRoot":"","sources":["../../src/providers/Google.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,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CAAC,cAAc,EAAE,EAAE;gBAC9D,IAAI,SAAS,EAAE;oBACb,aAAa,CAAC;wBACZ,GAAG,MAAM;wBACT,MAAM,EAAE;4BACN,QAAQ,EAAE,cAAc,EAAE,OAAO,IAAI,EAAE;4BACvC,YAAY,EAAE,cAAc,CAAC,WAAW;4BACxC,GAAG,MAAM,CAAC,MAAM;yBACjB;wBACD,cAAc;qBACf,CAAC,CAAC;iBACJ;YACH,CAAC,CAAC,CAAC;SACJ;aAAM;YACL,aAAa,CAAC,MAAM,CAAC,CAAC;SACvB;QACD,OAAO,GAAG,EAAE;YACV,SAAS,GAAG,KAAK,CAAC;QACpB,CAAC,CAAC;IACJ,CAAC,EAAE;QACD,QAAQ;QACR,WAAW;QACX,sBAAsB;QACtB,MAAM,CAAC,YAAY;QACnB,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC;QACxB,OAAO,EAAE,YAAY;QACrB,MAAM;KACP,CAAC,CAAC;IAEH,OAAO,CAAC,OAAO,EAAE,UAAU,EAAE,WAAW,CAAC,CAAC;AAC5C,CAAC","sourcesContent":["import * as Application from 'expo-application';\nimport { useEffect, useMemo, useState } from 'react';\nimport { Platform } from 'react-native';\n\nimport { useAuthRequestResult, useLoadedAuthRequest } from '../AuthRequestHooks';\nimport {\n AuthRequest,\n AuthRequestConfig,\n AuthRequestPromptOptions,\n AuthSessionRedirectUriOptions,\n AuthSessionResult,\n DiscoveryDocument,\n generateHexStringAsync,\n makeRedirectUri,\n Prompt,\n ResponseType,\n} from '../AuthSession';\nimport { AccessTokenRequest } from '../TokenRequest';\nimport { ProviderAuthRequestConfig } from './Provider.types';\nimport { applyRequiredScopes, invariantClientId, useProxyEnabled } from './ProviderUtils';\n\nconst settings = {\n windowFeatures: { width: 515, height: 680 },\n minimumScopes: [\n 'openid',\n 'https://www.googleapis.com/auth/userinfo.profile',\n 'https://www.googleapis.com/auth/userinfo.email',\n ],\n};\n\nexport const discovery: DiscoveryDocument = {\n authorizationEndpoint: 'https://accounts.google.com/o/oauth2/v2/auth',\n tokenEndpoint: 'https://oauth2.googleapis.com/token',\n revocationEndpoint: 'https://oauth2.googleapis.com/revoke',\n userInfoEndpoint: 'https://openidconnect.googleapis.com/v1/userinfo',\n};\n\n// @needsAudit\nexport interface GoogleAuthRequestConfig extends ProviderAuthRequestConfig {\n /**\n * If the user's email address is known ahead of time, it can be supplied to be the default option.\n * If the user has approved access for this app in the past then auth may return without any further interaction.\n */\n loginHint?: string;\n /**\n * When `true`, the service will allow the user to switch between accounts (if possible).\n * @default false.\n */\n selectAccount?: boolean;\n /**\n * Proxy client ID for use in the Expo client on iOS and Android.\n *\n * This Google Client ID must be setup as follows:\n *\n * - **Application Type**: Web Application\n * - **URIs**: https://auth.expo.io\n * - **Authorized redirect URIs**: https://auth.expo.io/@your-username/your-project-slug\n */\n expoClientId?: string;\n /**\n * Expo web client ID for use in the browser.\n *\n * This Google Client ID must be setup as follows:\n *\n * - **Application Type**: Web Application\n * - Give it a name (e.g. \"Web App\").\n * - **URIs** (Authorized JavaScript origins): https://localhost:19006 & https://yourwebsite.com\n * - **Authorized redirect URIs**: https://localhost:19006 & https://yourwebsite.com\n * - To test this be sure to start your app with `expo start:web --https`.\n */\n webClientId?: string;\n /**\n * iOS native client ID for use in standalone, bare workflow, and custom clients.\n *\n * This Google Client ID must be setup as follows:\n *\n * - **Application Type**: iOS Application\n * - Give it a name (e.g. \"iOS App\").\n * - **Bundle ID**: Must match the value of `ios.bundleIdentifier` in your `app.json`.\n * - Your app needs to conform to the URI scheme matching your bundle identifier.\n * - _Standalone_: Automatically added, do nothing.\n * - _Bare workflow_: Run `npx uri-scheme add <your bundle id> --ios`\n * - To test this you can:\n * 1. Prebuild to generate the native files: `expo prebuild` and run `yarn ios`\n * 2. Create a custom client: `expo client:ios`\n * 3. Build a production IPA: `expo build:ios`\n * - Whenever you change the values in `app.json` you'll need to rebuild the native app.\n */\n iosClientId?: string;\n /**\n * Android native client ID for use in standalone, and bare workflow.\n *\n * This Google Client ID must be setup as follows:\n *\n * - **Application Type**: Android Application\n * - Give it a name (e.g. \"Android App\").\n * - **Package name**: Must match the value of `android.package` in your `app.json`.\n * - Your app needs to conform to the URI scheme matching your `android.package` (ex. `com.myname.mycoolapp:/`).\n * - _Standalone_: Automatically added, do nothing.\n * - _Bare workflow_: Run `npx uri-scheme add <your android.package> --android`\n * - **Signing-certificate fingerprint**:\n * - Run `expo credentials:manager -p android` then select \"Update upload Keystore\" -> \"Generate new keystore\" -> \"Go back to experience overview\"\n * - Copy your \"Google Certificate Fingerprint\", it will output a string that looks like `A1:B2:C3` but longer.\n * - To test this you can:\n * 1. Prebuild to generate the native files: `expo prebuild` and run `yarn ios`\n * 2. Build a production IPA: `expo build:android`\n */\n androidClientId?: string;\n /**\n * Should the hook automatically exchange the response code for an authentication token.\n *\n * Defaults to `true` on installed apps (iOS, Android) when `ResponseType.Code` is used (default).\n */\n shouldAutoExchangeCode?: boolean;\n /**\n * Language code ISO 3166-1 alpha-2 region code, such as 'it' or 'pt-PT'.\n */\n language?: string;\n}\n\n// @needsAudit\n/**\n * Extends [`AuthRequest`](#authrequest) and accepts [`GoogleAuthRequestConfig`](#googleauthrequestconfig) in the constructor.\n */\nclass GoogleAuthRequest extends AuthRequest {\n nonce?: string;\n\n constructor({\n language,\n loginHint,\n selectAccount,\n extraParams = {},\n clientSecret,\n ...config\n }: GoogleAuthRequestConfig) {\n const inputParams = {\n ...extraParams,\n };\n if (language) inputParams.hl = language;\n if (loginHint) inputParams.login_hint = loginHint;\n if (selectAccount) inputParams.prompt = Prompt.SelectAccount;\n\n // Apply the default scopes\n const scopes = applyRequiredScopes(config.scopes, settings.minimumScopes);\n const isImplicit =\n config.responseType === ResponseType.Token || config.responseType === ResponseType.IdToken;\n if (isImplicit) {\n // PKCE must be disabled in implicit mode.\n config.usePKCE = false;\n }\n let inputClientSecret: string | undefined;\n // Google will throw if you attempt to use the client secret\n if (config.responseType && config.responseType !== ResponseType.Code) {\n // TODO: maybe warn that you shouldn't store the client secret on the client\n inputClientSecret = clientSecret;\n }\n super({\n ...config,\n clientSecret: inputClientSecret,\n scopes,\n extraParams: inputParams,\n });\n }\n\n /**\n * Load and return a valid auth request based on the input config.\n */\n async getAuthRequestConfigAsync(): Promise<AuthRequestConfig> {\n const { extraParams = {}, ...config } = await super.getAuthRequestConfigAsync();\n if (config.responseType === ResponseType.IdToken && !extraParams.nonce && !this.nonce) {\n if (!this.nonce) {\n this.nonce = await generateHexStringAsync(16);\n }\n extraParams.nonce = this.nonce;\n }\n return {\n ...config,\n extraParams,\n };\n }\n}\n\n/**\n * Load an authorization request with an ID Token for authentication with Firebase.\n *\n * Returns a loaded request, a response, and a prompt method.\n * When the prompt method completes then the response will be fulfilled.\n *\n * The id token can be retrieved with `response.params.id_token`.\n *\n * - [Get Started](https://docs.expo.dev/guides/authentication/#google)\n *\n * @param config\n * @param redirectUriOptions\n */\nexport function useIdTokenAuthRequest(\n config: Partial<GoogleAuthRequestConfig>,\n redirectUriOptions: Partial<AuthSessionRedirectUriOptions> = {}\n): [\n GoogleAuthRequest | null,\n AuthSessionResult | null,\n (options?: AuthRequestPromptOptions) => Promise<AuthSessionResult>\n] {\n const useProxy = useProxyEnabled(redirectUriOptions);\n\n const isWebAuth = useProxy || Platform.OS === 'web';\n\n return useAuthRequest(\n {\n ...config,\n responseType:\n // If the client secret is provided then code can be used\n !config.clientSecret &&\n // When web auth is used, we can request the `id_token` directly without exchanging a code.\n isWebAuth\n ? ResponseType.IdToken\n : undefined,\n },\n { ...redirectUriOptions, useProxy }\n );\n}\n\n/**\n * Load an authorization request.\n * Returns a loaded request, a response, and a prompt method.\n * When the prompt method completes, then the response will be fulfilled.\n *\n * - [Get Started](https://docs.expo.dev/guides/authentication/#google)\n *\n * @param config\n * @param redirectUriOptions\n */\nexport function useAuthRequest(\n config: Partial<GoogleAuthRequestConfig> = {},\n redirectUriOptions: Partial<AuthSessionRedirectUriOptions> = {}\n): [\n GoogleAuthRequest | null,\n AuthSessionResult | null,\n (options?: AuthRequestPromptOptions) => Promise<AuthSessionResult>\n] {\n const useProxy = useProxyEnabled(redirectUriOptions);\n\n const clientId = useMemo((): string => {\n const propertyName = useProxy\n ? 'expoClientId'\n : Platform.select({\n ios: 'iosClientId',\n android: 'androidClientId',\n default: 'webClientId',\n });\n\n const clientId = config[propertyName as any] ?? config.clientId;\n invariantClientId(propertyName, clientId, 'Google');\n return clientId;\n }, [\n useProxy,\n config.expoClientId,\n config.iosClientId,\n config.androidClientId,\n config.webClientId,\n config.clientId,\n ]);\n\n const responseType = useMemo(() => {\n // Allow overrides.\n if (typeof config.responseType !== 'undefined') {\n return config.responseType;\n }\n // You can only use `response_token=code` on installed apps (iOS, Android without proxy).\n // Installed apps can auto exchange without a client secret and get the token and id-token (Firebase).\n const isInstalledApp = Platform.OS !== 'web' && !useProxy;\n // If the user provided the client secret (they shouldn't!) then use code exchange by default.\n if (config.clientSecret || isInstalledApp) {\n return ResponseType.Code;\n }\n // This seems the most pragmatic option since it can result in a full authentication on web and proxy platforms as expected.\n return ResponseType.Token;\n }, [config.responseType, config.clientSecret, useProxy]);\n\n const redirectUri = useMemo((): string => {\n if (typeof config.redirectUri !== 'undefined') {\n return config.redirectUri;\n }\n\n return makeRedirectUri({\n native: `${Application.applicationId}:/oauthredirect`,\n useProxy,\n ...redirectUriOptions,\n // native: `com.googleusercontent.apps.${guid}:/oauthredirect`,\n });\n }, [useProxy, config.redirectUri, redirectUriOptions]);\n\n const extraParams = useMemo((): GoogleAuthRequestConfig['extraParams'] => {\n const output = config.extraParams ? { ...config.extraParams } : {};\n\n if (config.language) {\n output.hl = output.language;\n }\n if (config.loginHint) {\n output.login_hint = output.loginHint;\n }\n if (config.selectAccount) {\n output.prompt = Prompt.SelectAccount;\n }\n return output;\n }, [config.extraParams, config.language, config.loginHint, config.selectAccount]);\n\n const request = useLoadedAuthRequest(\n {\n ...config,\n responseType,\n extraParams,\n clientId,\n redirectUri,\n },\n discovery,\n GoogleAuthRequest\n );\n\n const [result, promptAsync] = useAuthRequestResult(request, discovery, {\n useProxy,\n windowFeatures: settings.windowFeatures,\n });\n\n const [fullResult, setFullResult] = useState<AuthSessionResult | null>(null);\n\n const shouldAutoExchangeCode = useMemo(() => {\n // allow overrides\n if (typeof config.shouldAutoExchangeCode !== 'undefined') {\n return config.shouldAutoExchangeCode;\n }\n\n // has a code to exchange and doesn't have an authentication yet.\n return result?.type === 'success' && result.params.code && !result.authentication;\n }, [config.shouldAutoExchangeCode, result?.type]);\n\n useEffect(() => {\n let isMounted = true;\n if (shouldAutoExchangeCode && result?.type === 'success') {\n const exchangeRequest = new AccessTokenRequest({\n clientId,\n clientSecret: config.clientSecret,\n redirectUri,\n scopes: config.scopes,\n code: result.params.code,\n extraParams: {\n code_verifier: request?.codeVerifier || '',\n },\n });\n exchangeRequest.performAsync(discovery).then((authentication) => {\n if (isMounted) {\n setFullResult({\n ...result,\n params: {\n id_token: authentication?.idToken || '',\n access_token: authentication.accessToken,\n ...result.params,\n },\n authentication,\n });\n }\n });\n } else {\n setFullResult(result);\n }\n return () => {\n isMounted = false;\n };\n }, [\n clientId,\n redirectUri,\n shouldAutoExchangeCode,\n config.clientSecret,\n config.scopes?.join(','),\n request?.codeVerifier,\n result,\n ]);\n\n return [request, fullResult, promptAsync];\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Google.js","sourceRoot":"","sources":["../../src/providers/Google.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AACjF,OAAO,EACL,WAAW,EAMX,sBAAsB,EACtB,eAAe,EACf,MAAM,EACN,YAAY,GACb,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE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WAAW;4BACxC,GAAG,MAAM,CAAC,MAAM;yBACjB;wBACD,cAAc;qBACf,CAAC,CAAC;iBACJ;YACH,CAAC,CAAC,CAAC;SACJ;aAAM;YACL,aAAa,CAAC,MAAM,CAAC,CAAC;SACvB;QACD,OAAO,GAAG,EAAE;YACV,SAAS,GAAG,KAAK,CAAC;QACpB,CAAC,CAAC;IACJ,CAAC,EAAE;QACD,QAAQ;QACR,WAAW;QACX,sBAAsB;QACtB,MAAM,CAAC,YAAY;QACnB,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC;QACxB,OAAO,EAAE,YAAY;QACrB,MAAM;KACP,CAAC,CAAC;IAEH,OAAO,CAAC,OAAO,EAAE,UAAU,EAAE,WAAW,CAAC,CAAC;AAC5C,CAAC","sourcesContent":["import * as Application from 'expo-application';\nimport { useEffect, useMemo, useState } from 'react';\nimport { Platform } from 'react-native';\n\nimport { useAuthRequestResult, useLoadedAuthRequest } from '../AuthRequestHooks';\nimport {\n AuthRequest,\n AuthRequestConfig,\n AuthRequestPromptOptions,\n AuthSessionRedirectUriOptions,\n AuthSessionResult,\n DiscoveryDocument,\n generateHexStringAsync,\n makeRedirectUri,\n Prompt,\n ResponseType,\n} from '../AuthSession';\nimport { AccessTokenRequest } from '../TokenRequest';\nimport { ProviderAuthRequestConfig } from './Provider.types';\nimport { applyRequiredScopes, invariantClientId, useProxyEnabled } from './ProviderUtils';\n\nconst settings = {\n windowFeatures: { width: 515, height: 680 },\n minimumScopes: [\n 'openid',\n 'https://www.googleapis.com/auth/userinfo.profile',\n 'https://www.googleapis.com/auth/userinfo.email',\n ],\n};\n\nexport const discovery: DiscoveryDocument = {\n authorizationEndpoint: 'https://accounts.google.com/o/oauth2/v2/auth',\n tokenEndpoint: 'https://oauth2.googleapis.com/token',\n revocationEndpoint: 'https://oauth2.googleapis.com/revoke',\n userInfoEndpoint: 'https://openidconnect.googleapis.com/v1/userinfo',\n};\n\n// @needsAudit\nexport interface GoogleAuthRequestConfig extends ProviderAuthRequestConfig {\n /**\n * If the user's email address is known ahead of time, it can be supplied to be the default option.\n * If the user has approved access for this app in the past then auth may return without any further interaction.\n */\n loginHint?: string;\n /**\n * When `true`, the service will allow the user to switch between accounts (if possible).\n * @default false.\n */\n selectAccount?: boolean;\n /**\n * Proxy client ID for use in the Expo client on iOS and Android.\n *\n * This Google Client ID must be setup as follows:\n *\n * - **Application Type**: Web Application\n * - **URIs**: https://auth.expo.io\n * - **Authorized redirect URIs**: https://auth.expo.io/@your-username/your-project-slug\n */\n expoClientId?: string;\n /**\n * Expo web client ID for use in the browser.\n *\n * This Google Client ID must be setup as follows:\n *\n * - **Application Type**: Web Application\n * - Give it a name (e.g. \"Web App\").\n * - **URIs** (Authorized JavaScript origins): https://localhost:19006 & https://yourwebsite.com\n * - **Authorized redirect URIs**: https://localhost:19006 & https://yourwebsite.com\n * - To test this be sure to start your app with `npx expo start --https`.\n */\n webClientId?: string;\n /**\n * iOS native client ID for use in standalone, bare workflow, and custom clients.\n *\n * This Google Client ID must be setup as follows:\n *\n * - **Application Type**: iOS Application\n * - Give it a name (e.g. \"iOS App\").\n * - **Bundle ID**: Must match the value of `ios.bundleIdentifier` in your `app.json`.\n * - Your app needs to conform to the URI scheme matching your bundle identifier.\n * - _Standalone_: Automatically added, do nothing.\n * - _Bare workflow_: Run `npx uri-scheme add <your bundle id> --ios`\n * - To test this you can:\n * 1. Prebuild to generate the native files: `expo prebuild` and run `yarn ios`\n * 2. Create a custom client: `expo client:ios`\n * 3. Build a production IPA: `expo build:ios`\n * - Whenever you change the values in `app.json` you'll need to rebuild the native app.\n */\n iosClientId?: string;\n /**\n * Android native client ID for use in standalone, and bare workflow.\n *\n * This Google Client ID must be setup as follows:\n *\n * - **Application Type**: Android Application\n * - Give it a name (e.g. \"Android App\").\n * - **Package name**: Must match the value of `android.package` in your `app.json`.\n * - Your app needs to conform to the URI scheme matching your `android.package` (ex. `com.myname.mycoolapp:/`).\n * - _Standalone_: Automatically added, do nothing.\n * - _Bare workflow_: Run `npx uri-scheme add <your android.package> --android`\n * - **Signing-certificate fingerprint**:\n * - Run `expo credentials:manager -p android` then select \"Update upload Keystore\" -> \"Generate new keystore\" -> \"Go back to experience overview\"\n * - Copy your \"Google Certificate Fingerprint\", it will output a string that looks like `A1:B2:C3` but longer.\n * - To test this you can:\n * 1. Prebuild to generate the native files: `expo prebuild` and run `yarn ios`\n * 2. Build a production IPA: `expo build:android`\n */\n androidClientId?: string;\n /**\n * Should the hook automatically exchange the response code for an authentication token.\n *\n * Defaults to `true` on installed apps (iOS, Android) when `ResponseType.Code` is used (default).\n */\n shouldAutoExchangeCode?: boolean;\n /**\n * Language code ISO 3166-1 alpha-2 region code, such as 'it' or 'pt-PT'.\n */\n language?: string;\n}\n\n// @needsAudit\n/**\n * Extends [`AuthRequest`](#authrequest) and accepts [`GoogleAuthRequestConfig`](#googleauthrequestconfig) in the constructor.\n */\nclass GoogleAuthRequest extends AuthRequest {\n nonce?: string;\n\n constructor({\n language,\n loginHint,\n selectAccount,\n extraParams = {},\n clientSecret,\n ...config\n }: GoogleAuthRequestConfig) {\n const inputParams = {\n ...extraParams,\n };\n if (language) inputParams.hl = language;\n if (loginHint) inputParams.login_hint = loginHint;\n if (selectAccount) inputParams.prompt = Prompt.SelectAccount;\n\n // Apply the default scopes\n const scopes = applyRequiredScopes(config.scopes, settings.minimumScopes);\n const isImplicit =\n config.responseType === ResponseType.Token || config.responseType === ResponseType.IdToken;\n if (isImplicit) {\n // PKCE must be disabled in implicit mode.\n config.usePKCE = false;\n }\n let inputClientSecret: string | undefined;\n // Google will throw if you attempt to use the client secret\n if (config.responseType && config.responseType !== ResponseType.Code) {\n // TODO: maybe warn that you shouldn't store the client secret on the client\n inputClientSecret = clientSecret;\n }\n super({\n ...config,\n clientSecret: inputClientSecret,\n scopes,\n extraParams: inputParams,\n });\n }\n\n /**\n * Load and return a valid auth request based on the input config.\n */\n async getAuthRequestConfigAsync(): Promise<AuthRequestConfig> {\n const { extraParams = {}, ...config } = await super.getAuthRequestConfigAsync();\n if (config.responseType === ResponseType.IdToken && !extraParams.nonce && !this.nonce) {\n if (!this.nonce) {\n this.nonce = await generateHexStringAsync(16);\n }\n extraParams.nonce = this.nonce;\n }\n return {\n ...config,\n extraParams,\n };\n }\n}\n\n/**\n * Load an authorization request with an ID Token for authentication with Firebase.\n *\n * Returns a loaded request, a response, and a prompt method.\n * When the prompt method completes then the response will be fulfilled.\n *\n * The id token can be retrieved with `response.params.id_token`.\n *\n * - [Get Started](https://docs.expo.dev/guides/authentication/#google)\n *\n * @param config\n * @param redirectUriOptions\n */\nexport function useIdTokenAuthRequest(\n config: Partial<GoogleAuthRequestConfig>,\n redirectUriOptions: Partial<AuthSessionRedirectUriOptions> = {}\n): [\n GoogleAuthRequest | null,\n AuthSessionResult | null,\n (options?: AuthRequestPromptOptions) => Promise<AuthSessionResult>\n] {\n const useProxy = useProxyEnabled(redirectUriOptions);\n\n const isWebAuth = useProxy || Platform.OS === 'web';\n\n return useAuthRequest(\n {\n ...config,\n responseType:\n // If the client secret is provided then code can be used\n !config.clientSecret &&\n // When web auth is used, we can request the `id_token` directly without exchanging a code.\n isWebAuth\n ? ResponseType.IdToken\n : undefined,\n },\n { ...redirectUriOptions, useProxy }\n );\n}\n\n/**\n * Load an authorization request.\n * Returns a loaded request, a response, and a prompt method.\n * When the prompt method completes, then the response will be fulfilled.\n *\n * - [Get Started](https://docs.expo.dev/guides/authentication/#google)\n *\n * @param config\n * @param redirectUriOptions\n */\nexport function useAuthRequest(\n config: Partial<GoogleAuthRequestConfig> = {},\n redirectUriOptions: Partial<AuthSessionRedirectUriOptions> = {}\n): [\n GoogleAuthRequest | null,\n AuthSessionResult | null,\n (options?: AuthRequestPromptOptions) => Promise<AuthSessionResult>\n] {\n const useProxy = useProxyEnabled(redirectUriOptions);\n\n const clientId = useMemo((): string => {\n const propertyName = useProxy\n ? 'expoClientId'\n : Platform.select({\n ios: 'iosClientId',\n android: 'androidClientId',\n default: 'webClientId',\n });\n\n const clientId = config[propertyName as any] ?? config.clientId;\n invariantClientId(propertyName, clientId, 'Google');\n return clientId;\n }, [\n useProxy,\n config.expoClientId,\n config.iosClientId,\n config.androidClientId,\n config.webClientId,\n config.clientId,\n ]);\n\n const responseType = useMemo(() => {\n // Allow overrides.\n if (typeof config.responseType !== 'undefined') {\n return config.responseType;\n }\n // You can only use `response_token=code` on installed apps (iOS, Android without proxy).\n // Installed apps can auto exchange without a client secret and get the token and id-token (Firebase).\n const isInstalledApp = Platform.OS !== 'web' && !useProxy;\n // If the user provided the client secret (they shouldn't!) then use code exchange by default.\n if (config.clientSecret || isInstalledApp) {\n return ResponseType.Code;\n }\n // This seems the most pragmatic option since it can result in a full authentication on web and proxy platforms as expected.\n return ResponseType.Token;\n }, [config.responseType, config.clientSecret, useProxy]);\n\n const redirectUri = useMemo((): string => {\n if (typeof config.redirectUri !== 'undefined') {\n return config.redirectUri;\n }\n\n return makeRedirectUri({\n native: `${Application.applicationId}:/oauthredirect`,\n useProxy,\n ...redirectUriOptions,\n // native: `com.googleusercontent.apps.${guid}:/oauthredirect`,\n });\n }, [useProxy, config.redirectUri, redirectUriOptions]);\n\n const extraParams = useMemo((): GoogleAuthRequestConfig['extraParams'] => {\n const output = config.extraParams ? { ...config.extraParams } : {};\n\n if (config.language) {\n output.hl = output.language;\n }\n if (config.loginHint) {\n output.login_hint = output.loginHint;\n }\n if (config.selectAccount) {\n output.prompt = Prompt.SelectAccount;\n }\n return output;\n }, [config.extraParams, config.language, config.loginHint, config.selectAccount]);\n\n const request = useLoadedAuthRequest(\n {\n ...config,\n responseType,\n extraParams,\n clientId,\n redirectUri,\n },\n discovery,\n GoogleAuthRequest\n );\n\n const [result, promptAsync] = useAuthRequestResult(request, discovery, {\n useProxy,\n windowFeatures: settings.windowFeatures,\n });\n\n const [fullResult, setFullResult] = useState<AuthSessionResult | null>(null);\n\n const shouldAutoExchangeCode = useMemo(() => {\n // allow overrides\n if (typeof config.shouldAutoExchangeCode !== 'undefined') {\n return config.shouldAutoExchangeCode;\n }\n\n // has a code to exchange and doesn't have an authentication yet.\n return result?.type === 'success' && result.params.code && !result.authentication;\n }, [config.shouldAutoExchangeCode, result?.type]);\n\n useEffect(() => {\n let isMounted = true;\n if (shouldAutoExchangeCode && result?.type === 'success') {\n const exchangeRequest = new AccessTokenRequest({\n clientId,\n clientSecret: config.clientSecret,\n redirectUri,\n scopes: config.scopes,\n code: result.params.code,\n extraParams: {\n code_verifier: request?.codeVerifier || '',\n },\n });\n exchangeRequest.performAsync(discovery).then((authentication) => {\n if (isMounted) {\n setFullResult({\n ...result,\n params: {\n id_token: authentication?.idToken || '',\n access_token: authentication.accessToken,\n ...result.params,\n },\n authentication,\n });\n }\n });\n } else {\n setFullResult(result);\n }\n return () => {\n isMounted = false;\n };\n }, [\n clientId,\n redirectUri,\n shouldAutoExchangeCode,\n config.clientSecret,\n config.scopes?.join(','),\n request?.codeVerifier,\n result,\n ]);\n\n return [request, fullResult, promptAsync];\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-auth-session",
|
|
3
|
-
"version": "3.7.
|
|
3
|
+
"version": "3.7.2",
|
|
4
4
|
"description": "Expo module for browser-based authentication",
|
|
5
5
|
"main": "build/AuthSession.js",
|
|
6
6
|
"types": "build/AuthSession.d.ts",
|
|
@@ -34,16 +34,16 @@
|
|
|
34
34
|
"license": "MIT",
|
|
35
35
|
"homepage": "https://docs.expo.dev/versions/latest/sdk/auth-session",
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"expo-constants": "~
|
|
38
|
-
"expo-crypto": "~
|
|
37
|
+
"expo-constants": "~14.0.0",
|
|
38
|
+
"expo-crypto": "~12.0.0",
|
|
39
39
|
"expo-linking": "~3.2.0",
|
|
40
|
-
"expo-web-browser": "~
|
|
40
|
+
"expo-web-browser": "~12.0.0",
|
|
41
41
|
"invariant": "^2.2.4",
|
|
42
42
|
"qs": "6.9.1"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@types/qs": "^6.5.3",
|
|
46
|
-
"expo-module-scripts": "^
|
|
46
|
+
"expo-module-scripts": "^3.0.0"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"expo-random": "*"
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"jest": {
|
|
57
57
|
"preset": "expo-module-scripts"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "eab2b09c735fb0fc2bf734a3f29a6593adba3838"
|
|
60
60
|
}
|
package/src/AuthRequest.types.ts
CHANGED
|
@@ -85,7 +85,7 @@ export type AuthRequestPromptOptions = Omit<WebBrowserOpenOptions, 'windowFeatur
|
|
|
85
85
|
*/
|
|
86
86
|
useProxy?: boolean;
|
|
87
87
|
/**
|
|
88
|
-
* Project name to use for the
|
|
88
|
+
* Project name to use for the `auth.expo.io` proxy when `useProxy` is `true`.
|
|
89
89
|
*/
|
|
90
90
|
projectNameForProxy?: string;
|
|
91
91
|
/**
|
|
@@ -124,7 +124,7 @@ export interface AuthRequestConfig {
|
|
|
124
124
|
clientId: string;
|
|
125
125
|
/**
|
|
126
126
|
* After completing an interaction with a resource owner the
|
|
127
|
-
* server will redirect to this URI. Learn more about [linking in Expo](
|
|
127
|
+
* server will redirect to this URI. Learn more about [linking in Expo](/guides/linking/).
|
|
128
128
|
*
|
|
129
129
|
* [Section 3.1.2](https://tools.ietf.org/html/rfc6749#section-3.1.2)
|
|
130
130
|
*/
|
package/src/AuthSession.ts
CHANGED
|
@@ -151,7 +151,7 @@ export function getRedirectUrl(path?: string): string {
|
|
|
151
151
|
* scheme: 'my-scheme',
|
|
152
152
|
* path: 'redirect'
|
|
153
153
|
* });
|
|
154
|
-
* //
|
|
154
|
+
* // Development Build: my-scheme://redirect
|
|
155
155
|
* // Expo Go: exp://127.0.0.1:19000/--/redirect
|
|
156
156
|
* // Web dev: https://localhost:19006/redirect
|
|
157
157
|
* // Web prod: https://yourwebsite.com/redirect
|
|
@@ -161,7 +161,7 @@ export function getRedirectUrl(path?: string): string {
|
|
|
161
161
|
* preferLocalhost: true,
|
|
162
162
|
* isTripleSlashed: true,
|
|
163
163
|
* });
|
|
164
|
-
* //
|
|
164
|
+
* // Development Build: scheme2:///
|
|
165
165
|
* // Expo Go: exp://localhost:19000
|
|
166
166
|
* // Web dev: https://localhost:19006
|
|
167
167
|
* // Web prod: https://yourwebsite.com
|
|
@@ -169,7 +169,7 @@ export function getRedirectUrl(path?: string): string {
|
|
|
169
169
|
* const redirectUri3 = makeRedirectUri({
|
|
170
170
|
* useProxy: true,
|
|
171
171
|
* });
|
|
172
|
-
* //
|
|
172
|
+
* // Development Build: https://auth.expo.io/@username/slug
|
|
173
173
|
* // Expo Go: https://auth.expo.io/@username/slug
|
|
174
174
|
* // Web dev: https://localhost:19006
|
|
175
175
|
* // Web prod: https://yourwebsite.com
|
package/src/AuthSession.types.ts
CHANGED
|
@@ -20,7 +20,7 @@ export type AuthSessionOptions = {
|
|
|
20
20
|
*/
|
|
21
21
|
showInRecents?: boolean;
|
|
22
22
|
/**
|
|
23
|
-
* Project name to use for the
|
|
23
|
+
* Project name to use for the `auth.expo.io` proxy.
|
|
24
24
|
*/
|
|
25
25
|
projectNameForProxy?: string;
|
|
26
26
|
};
|
|
@@ -103,7 +103,7 @@ export type AuthSessionRedirectUriOptions = {
|
|
|
103
103
|
*/
|
|
104
104
|
useProxy?: boolean;
|
|
105
105
|
/**
|
|
106
|
-
* Project name to use for the
|
|
106
|
+
* Project name to use for the `auth.expo.io` proxy when `useProxy` is `true`.
|
|
107
107
|
*/
|
|
108
108
|
projectNameForProxy?: string;
|
|
109
109
|
/**
|
|
@@ -50,8 +50,7 @@ export class SessionUrlProvider {
|
|
|
50
50
|
|
|
51
51
|
const legacyExpoProjectFullName =
|
|
52
52
|
options.projectNameForProxy ||
|
|
53
|
-
Constants.
|
|
54
|
-
Constants.manifest2?.extra?.expoClient?.originalFullName ||
|
|
53
|
+
Constants.expoConfig?.originalFullName ||
|
|
55
54
|
Constants.manifest?.id;
|
|
56
55
|
|
|
57
56
|
if (!legacyExpoProjectFullName) {
|
|
@@ -87,9 +86,6 @@ export class SessionUrlProvider {
|
|
|
87
86
|
|
|
88
87
|
private static getHostAddressQueryParams(): ParsedQs | undefined {
|
|
89
88
|
let hostUri: string | undefined =
|
|
90
|
-
// @ts-ignore: hostUri isn't defined on the expoClient type, because
|
|
91
|
-
// Constants.manifest is of type AppManifest while
|
|
92
|
-
// Constants.manifest2.extra.expoClient is of type ExpoConfig
|
|
93
89
|
Constants.manifest?.hostUri ?? Constants.manifest2?.extra?.expoClient?.hostUri;
|
|
94
90
|
if (
|
|
95
91
|
!hostUri &&
|
|
@@ -142,6 +142,7 @@ export function useAuthRequest(
|
|
|
142
142
|
// The redirect URI should be created using fb + client ID on native.
|
|
143
143
|
native: `fb${clientId}://authorize`,
|
|
144
144
|
useProxy,
|
|
145
|
+
projectNameForProxy: '@community/native-component-list',
|
|
145
146
|
...redirectUriOptions,
|
|
146
147
|
});
|
|
147
148
|
}, [useProxy, clientId, config.redirectUri, redirectUriOptions]);
|
package/src/providers/Google.ts
CHANGED
|
@@ -66,7 +66,7 @@ export interface GoogleAuthRequestConfig extends ProviderAuthRequestConfig {
|
|
|
66
66
|
* - Give it a name (e.g. "Web App").
|
|
67
67
|
* - **URIs** (Authorized JavaScript origins): https://localhost:19006 & https://yourwebsite.com
|
|
68
68
|
* - **Authorized redirect URIs**: https://localhost:19006 & https://yourwebsite.com
|
|
69
|
-
* - To test this be sure to start your app with `expo start
|
|
69
|
+
* - To test this be sure to start your app with `npx expo start --https`.
|
|
70
70
|
*/
|
|
71
71
|
webClientId?: string;
|
|
72
72
|
/**
|