expo-auth-session 6.1.2 → 6.1.3
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
CHANGED
|
@@ -22,7 +22,7 @@ export declare function useAuthRequestResult(request: AuthRequest | null, discov
|
|
|
22
22
|
* Load an authorization request for a code. When the prompt method completes then the response will be fulfilled.
|
|
23
23
|
*
|
|
24
24
|
* > In order to close the popup window on web, you need to invoke `WebBrowser.maybeCompleteAuthSession()`.
|
|
25
|
-
* > See the [
|
|
25
|
+
* > See the [GitHub example](/guides/authentication#github) for more info.
|
|
26
26
|
*
|
|
27
27
|
* If an Implicit grant flow was used, you can pass the `response.params` to `TokenResponse.fromQueryParams()`
|
|
28
28
|
* to get a `TokenResponse` instance which you can use to easily refresh the token.
|
|
@@ -99,7 +99,7 @@ export function useAuthRequestResult(request, discovery, customOptions = {}) {
|
|
|
99
99
|
* Load an authorization request for a code. When the prompt method completes then the response will be fulfilled.
|
|
100
100
|
*
|
|
101
101
|
* > In order to close the popup window on web, you need to invoke `WebBrowser.maybeCompleteAuthSession()`.
|
|
102
|
-
* > See the [
|
|
102
|
+
* > See the [GitHub example](/guides/authentication#github) for more info.
|
|
103
103
|
*
|
|
104
104
|
* If an Implicit grant flow was used, you can pass the `response.params` to `TokenResponse.fromQueryParams()`
|
|
105
105
|
* to get a `TokenResponse` instance which you can use to easily refresh the token.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthRequestHooks.js","sourceRoot":"","sources":["../src/AuthRequestHooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAElE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,OAAO,EAAwC,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAE1F,cAAc;AACd;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,gBA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E,CAAC;gBACvC,GAAG,cAAc;aAClB;SACF,CAAC;QACF,MAAM,MAAM,GAAG,MAAM,OAAO,EAAE,WAAW,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;QACnE,SAAS,CAAC,MAAM,CAAC,CAAC;QAClB,OAAO,MAAM,CAAC;IAChB,CAAC,EACD,CAAC,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,qBAAqB,CAAC,CACjD,CAAC;IAEF,OAAO,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;AAC/B,CAAC;AAED,cAAc;AACd;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,cAAc,CAC5B,MAAyB,EACzB,SAAmC;IAMnC,MAAM,OAAO,GAAG,oBAAoB,CAAC,MAAM,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;IACrE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,oBAAoB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IACvE,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;AACxC,CAAC","sourcesContent":["import { useCallback, useMemo, useEffect, useState } from 'react';\n\nimport { AuthRequest } from './AuthRequest';\nimport { AuthRequestConfig, AuthRequestPromptOptions, Prompt } from './AuthRequest.types';\nimport { AuthSessionResult } from './AuthSession.types';\nimport { DiscoveryDocument, IssuerOrDiscovery, resolveDiscoveryAsync } from './Discovery';\n\n// @needsAudit\n/**\n * Given an OpenID Connect issuer URL, this will fetch and return the [`DiscoveryDocument`](#discoverydocument)\n * (a collection of URLs) from the resource provider.\n *\n * @param issuerOrDiscovery URL using the `https` scheme with no query or fragment component that the OP asserts as its Issuer Identifier.\n * @return Returns `null` until the [`DiscoveryDocument`](#discoverydocument) has been fetched from the provided issuer URL.\n *\n * @example\n * ```ts\n * const discovery = useAutoDiscovery('https://example.com/auth');\n * ```\n */\nexport function useAutoDiscovery(issuerOrDiscovery: IssuerOrDiscovery): DiscoveryDocument | null {\n const [discovery, setDiscovery] = useState<DiscoveryDocument | null>(null);\n\n useEffect(() => {\n let isAllowed = true;\n resolveDiscoveryAsync(issuerOrDiscovery).then((discovery) => {\n if (isAllowed) {\n setDiscovery(discovery);\n }\n });\n\n return () => {\n isAllowed = false;\n };\n }, [issuerOrDiscovery]);\n\n return discovery;\n}\n\nexport function useLoadedAuthRequest(\n config: AuthRequestConfig,\n discovery: DiscoveryDocument | null,\n AuthRequestInstance: typeof AuthRequest\n): AuthRequest | null {\n const [request, setRequest] = useState<AuthRequest | null>(null);\n const scopeString = config.scopes?.join(' ');\n const promptString = createPromptString(config.prompt);\n const extraParamsString = useMemo(\n () => JSON.stringify(config.extraParams || {}),\n [config.extraParams]\n );\n useEffect(() => {\n let isMounted = true;\n\n if (discovery) {\n const request = new AuthRequestInstance(config);\n request.makeAuthUrlAsync(discovery).then(() => {\n if (isMounted) {\n setRequest(request);\n }\n });\n }\n return () => {\n isMounted = false;\n };\n }, [\n discovery?.authorizationEndpoint,\n config.clientId,\n config.redirectUri,\n config.responseType,\n config.clientSecret,\n config.codeChallenge,\n config.state,\n config.usePKCE,\n scopeString,\n promptString,\n extraParamsString,\n ]);\n return request;\n}\n\n/**\n * @returns Prompt type converted to a primitive value to be used as a React hook dependency\n */\nfunction createPromptString(prompt: Prompt | Prompt[] | undefined): string | undefined {\n if (!prompt) {\n return;\n }\n\n if (Array.isArray(prompt)) {\n return prompt.join(' ');\n }\n\n return prompt;\n}\n\nexport type PromptMethod = (options?: AuthRequestPromptOptions) => Promise<AuthSessionResult>;\n\nexport function useAuthRequestResult(\n request: AuthRequest | null,\n discovery: DiscoveryDocument | null,\n customOptions: AuthRequestPromptOptions = {}\n): [AuthSessionResult | null, PromptMethod] {\n const [result, setResult] = useState<AuthSessionResult | null>(null);\n\n const promptAsync = useCallback(\n async ({ windowFeatures = {}, ...options }: AuthRequestPromptOptions = {}) => {\n if (!discovery || !request) {\n throw new Error('Cannot prompt to authenticate until the request has finished loading.');\n }\n const inputOptions = {\n ...customOptions,\n ...options,\n windowFeatures: {\n ...(customOptions.windowFeatures ?? {}),\n ...windowFeatures,\n },\n };\n const result = await request?.promptAsync(discovery, inputOptions);\n setResult(result);\n return result;\n },\n [request?.url, discovery?.authorizationEndpoint]\n );\n\n return [result, promptAsync];\n}\n\n// @needsAudit\n/**\n * Load an authorization request for a code. When the prompt method completes then the response will be fulfilled.\n *\n * > In order to close the popup window on web, you need to invoke `WebBrowser.maybeCompleteAuthSession()`.\n * > See the [
|
|
1
|
+
{"version":3,"file":"AuthRequestHooks.js","sourceRoot":"","sources":["../src/AuthRequestHooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAElE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,OAAO,EAAwC,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAE1F,cAAc;AACd;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,gBAAgB,CAAC,iBAAoC;IACnE,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAA2B,IAAI,CAAC,CAAC;IAE3E,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,SAAS,GAAG,IAAI,CAAC;QACrB,qBAAqB,CAAC,iBAAiB,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE;YAC1D,IAAI,SAAS,EAAE,CAAC;gBACd,YAAY,CAAC,SAAS,CAAC,CAAC;YAC1B,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,OAAO,GAAG,EAAE;YACV,SAAS,GAAG,KAAK,CAAC;QACpB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,iBAAiB,CAAC,CAAC,CAAC;IAExB,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,oBAAoB,CAClC,MAAyB,EACzB,SAAmC,EACnC,mBAAuC;IAEvC,MAAM,CAAC,OAAO,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S,CAAC,CAAC;IACvE,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;AACxC,CAAC","sourcesContent":["import { useCallback, useMemo, useEffect, useState } from 'react';\n\nimport { AuthRequest } from './AuthRequest';\nimport { AuthRequestConfig, AuthRequestPromptOptions, Prompt } from './AuthRequest.types';\nimport { AuthSessionResult } from './AuthSession.types';\nimport { DiscoveryDocument, IssuerOrDiscovery, resolveDiscoveryAsync } from './Discovery';\n\n// @needsAudit\n/**\n * Given an OpenID Connect issuer URL, this will fetch and return the [`DiscoveryDocument`](#discoverydocument)\n * (a collection of URLs) from the resource provider.\n *\n * @param issuerOrDiscovery URL using the `https` scheme with no query or fragment component that the OP asserts as its Issuer Identifier.\n * @return Returns `null` until the [`DiscoveryDocument`](#discoverydocument) has been fetched from the provided issuer URL.\n *\n * @example\n * ```ts\n * const discovery = useAutoDiscovery('https://example.com/auth');\n * ```\n */\nexport function useAutoDiscovery(issuerOrDiscovery: IssuerOrDiscovery): DiscoveryDocument | null {\n const [discovery, setDiscovery] = useState<DiscoveryDocument | null>(null);\n\n useEffect(() => {\n let isAllowed = true;\n resolveDiscoveryAsync(issuerOrDiscovery).then((discovery) => {\n if (isAllowed) {\n setDiscovery(discovery);\n }\n });\n\n return () => {\n isAllowed = false;\n };\n }, [issuerOrDiscovery]);\n\n return discovery;\n}\n\nexport function useLoadedAuthRequest(\n config: AuthRequestConfig,\n discovery: DiscoveryDocument | null,\n AuthRequestInstance: typeof AuthRequest\n): AuthRequest | null {\n const [request, setRequest] = useState<AuthRequest | null>(null);\n const scopeString = config.scopes?.join(' ');\n const promptString = createPromptString(config.prompt);\n const extraParamsString = useMemo(\n () => JSON.stringify(config.extraParams || {}),\n [config.extraParams]\n );\n useEffect(() => {\n let isMounted = true;\n\n if (discovery) {\n const request = new AuthRequestInstance(config);\n request.makeAuthUrlAsync(discovery).then(() => {\n if (isMounted) {\n setRequest(request);\n }\n });\n }\n return () => {\n isMounted = false;\n };\n }, [\n discovery?.authorizationEndpoint,\n config.clientId,\n config.redirectUri,\n config.responseType,\n config.clientSecret,\n config.codeChallenge,\n config.state,\n config.usePKCE,\n scopeString,\n promptString,\n extraParamsString,\n ]);\n return request;\n}\n\n/**\n * @returns Prompt type converted to a primitive value to be used as a React hook dependency\n */\nfunction createPromptString(prompt: Prompt | Prompt[] | undefined): string | undefined {\n if (!prompt) {\n return;\n }\n\n if (Array.isArray(prompt)) {\n return prompt.join(' ');\n }\n\n return prompt;\n}\n\nexport type PromptMethod = (options?: AuthRequestPromptOptions) => Promise<AuthSessionResult>;\n\nexport function useAuthRequestResult(\n request: AuthRequest | null,\n discovery: DiscoveryDocument | null,\n customOptions: AuthRequestPromptOptions = {}\n): [AuthSessionResult | null, PromptMethod] {\n const [result, setResult] = useState<AuthSessionResult | null>(null);\n\n const promptAsync = useCallback(\n async ({ windowFeatures = {}, ...options }: AuthRequestPromptOptions = {}) => {\n if (!discovery || !request) {\n throw new Error('Cannot prompt to authenticate until the request has finished loading.');\n }\n const inputOptions = {\n ...customOptions,\n ...options,\n windowFeatures: {\n ...(customOptions.windowFeatures ?? {}),\n ...windowFeatures,\n },\n };\n const result = await request?.promptAsync(discovery, inputOptions);\n setResult(result);\n return result;\n },\n [request?.url, discovery?.authorizationEndpoint]\n );\n\n return [result, promptAsync];\n}\n\n// @needsAudit\n/**\n * Load an authorization request for a code. When the prompt method completes then the response will be fulfilled.\n *\n * > In order to close the popup window on web, you need to invoke `WebBrowser.maybeCompleteAuthSession()`.\n * > See the [GitHub example](/guides/authentication#github) for more info.\n *\n * If an Implicit grant flow was used, you can pass the `response.params` to `TokenResponse.fromQueryParams()`\n * to get a `TokenResponse` instance which you can use to easily refresh the token.\n *\n * @param config A valid [`AuthRequestConfig`](#authrequestconfig) that specifies what provider to use.\n * @param discovery A loaded [`DiscoveryDocument`](#discoverydocument) with endpoints used for authenticating.\n * Only `authorizationEndpoint` is required for requesting an authorization code.\n *\n * @return Returns a loaded request, a response, and a prompt method in a single array in the following order:\n * - `request` - An instance of [`AuthRequest`](#authrequest) that can be used to prompt the user for authorization.\n * This will be `null` until the auth request has finished loading.\n * - `response` - This is `null` until `promptAsync` has been invoked. Once fulfilled it will return information about the authorization.\n * - `promptAsync` - When invoked, a web browser will open up and prompt the user for authentication.\n * Accepts an [`AuthRequestPromptOptions`](#authrequestpromptoptions) object with options about how the prompt will execute.\n *\n * @example\n * ```ts\n * const [request, response, promptAsync] = useAuthRequest({ ... }, { ... });\n * ```\n */\nexport function useAuthRequest(\n config: AuthRequestConfig,\n discovery: DiscoveryDocument | null\n): [\n AuthRequest | null,\n AuthSessionResult | null,\n (options?: AuthRequestPromptOptions) => Promise<AuthSessionResult>,\n] {\n const request = useLoadedAuthRequest(config, discovery, AuthRequest);\n const [result, promptAsync] = useAuthRequestResult(request, discovery);\n return [request, result, promptAsync];\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-auth-session",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.3",
|
|
4
4
|
"description": "Expo module for browser-based authentication",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"expo-constants": "~17.1.2",
|
|
39
39
|
"expo-crypto": "~14.1.2",
|
|
40
40
|
"expo-linking": "~7.1.2",
|
|
41
|
-
"expo-web-browser": "~14.1.
|
|
41
|
+
"expo-web-browser": "~14.1.4",
|
|
42
42
|
"invariant": "^2.2.4"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"jest": {
|
|
52
52
|
"preset": "expo-module-scripts"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "f1394f21ff2719a9a3037d7511db170704e5c492"
|
|
55
55
|
}
|
package/src/AuthRequestHooks.ts
CHANGED
|
@@ -131,7 +131,7 @@ export function useAuthRequestResult(
|
|
|
131
131
|
* Load an authorization request for a code. When the prompt method completes then the response will be fulfilled.
|
|
132
132
|
*
|
|
133
133
|
* > In order to close the popup window on web, you need to invoke `WebBrowser.maybeCompleteAuthSession()`.
|
|
134
|
-
* > See the [
|
|
134
|
+
* > See the [GitHub example](/guides/authentication#github) for more info.
|
|
135
135
|
*
|
|
136
136
|
* If an Implicit grant flow was used, you can pass the `response.params` to `TokenResponse.fromQueryParams()`
|
|
137
137
|
* to get a `TokenResponse` instance which you can use to easily refresh the token.
|