@versini/auth0-react-thin 2.22.1 → 2.23.0

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.
@@ -1 +1 @@
1
- {"version":3,"file":"with-authentication-required.d.ts","sourceRoot":"","sources":["../src/with-authentication-required.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAa,EAAE,EAAE,MAAM,OAAO,CAAC;AAE5D,OAAqB,EACnB,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,iBAAiB,CAAC;AAkBzB;;GAEG;AACH,MAAM,WAAW,iCAAiC;IAChD;;;;;;;;;;;;;;;;OAgBG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,CAAC;IACnC;;;;;;;;OAQG;IACH,aAAa,CAAC,EAAE,MAAM,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC;IACxC;;;;;;;;OAQG;IACH,sBAAsB,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7C;;;;;;;;;;;;;OAaG;IACH,YAAY,CAAC,EAAE,oBAAoB,CAAC;IACpC;;;;OAIG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC;CAChD;AAED;;;;;;;GAOG;AACH,QAAA,MAAM,0BAA0B,GAAI,CAAC,SAAS,MAAM,EAClD,WAAW,aAAa,CAAC,CAAC,CAAC,EAC3B,UAAS,iCAAsC,KAC9C,EAAE,CAAC,CAAC,CAuCN,CAAC;AAEF,eAAe,0BAA0B,CAAC"}
1
+ {"version":3,"file":"with-authentication-required.d.ts","sourceRoot":"","sources":["../src/with-authentication-required.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAa,EAAE,EAAE,MAAM,OAAO,CAAC;AAE5D,OAAqB,EACnB,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,iBAAiB,CAAC;AAwBzB;;GAEG;AACH,MAAM,WAAW,iCAAiC;IAChD;;;;;;;;;;;;;;;;OAgBG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,CAAC;IACnC;;;;;;;;OAQG;IACH,aAAa,CAAC,EAAE,MAAM,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC;IACxC;;;;;;;;OAQG;IACH,sBAAsB,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7C;;;;;;;;;;;;;OAaG;IACH,YAAY,CAAC,EAAE,oBAAoB,CAAC;IACpC;;;;OAIG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC;CAChD;AAED;;;;;;;GAOG;AACH,QAAA,MAAM,0BAA0B,GAAI,CAAC,SAAS,MAAM,EAClD,WAAW,aAAa,CAAC,CAAC,CAAC,EAC3B,UAAS,iCAAsC,KAC9C,EAAE,CAAC,CAAC,CAuCN,CAAC;AAEF,eAAe,0BAA0B,CAAC"}
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "author": "Auth0",
3
3
  "name": "@versini/auth0-react-thin",
4
- "version": "2.22.1",
5
- "description": "Unofficial slim fork of @auth0/auth0-react@2.22.1 — bundle-size build, not affiliated with Auth0/Okta. See @versini/auth0-thin.",
4
+ "version": "2.23.0",
5
+ "description": "Unofficial slim fork of @auth0/auth0-react@2.23.0 — bundle-size build, not affiliated with Auth0/Okta. See @versini/auth0-thin.",
6
6
  "keywords": [
7
7
  "auth0",
8
8
  "fork",
@@ -34,7 +34,7 @@
34
34
  "dependencies": {
35
35
  "@auth0/auth0-spa-js": "^2.24.1"
36
36
  },
37
- "forkedFrom": "@auth0/auth0-react@2.22.1",
37
+ "forkedFrom": "@auth0/auth0-react@2.23.0",
38
38
  "publishConfig": {
39
39
  "access": "public"
40
40
  }
@@ -168,6 +168,11 @@ const defaultOnRedirectCallback = (appState?: AppState): void => {
168
168
  * ```
169
169
  *
170
170
  * Provides the Auth0Context to its child components.
171
+ *
172
+ * The SDK is a client-only module (its published ESM and CommonJS bundles ship the
173
+ * `'use client'` directive), so in a Next.js App Router app you can import and render
174
+ * `Auth0Provider` directly from a Server Component such as `app/layout.tsx`.
175
+ * Components that call hooks like `useAuth0` must still be Client Components.
171
176
  */
172
177
  const Auth0Provider = <TUser extends User = User>(opts: Auth0ProviderOptions<TUser>) => {
173
178
  const {
@@ -18,8 +18,14 @@ const defaultOnBeforeAuthentication = async (): Promise<void> => {/* noop */ };
18
18
  /**
19
19
  * @ignore
20
20
  */
21
- const defaultReturnTo = (): string =>
22
- `${window.location.pathname}${window.location.search}`;
21
+ const defaultReturnTo = (): string => {
22
+ // Normalize the pathname to prevent protocol-relative open redirects.
23
+ // A URL like https://app.example.com//evil.com produces a pathname of
24
+ // //evil.com, which routers (react-router, next.js, gatsby) interpret as a
25
+ // protocol-relative URL and redirect the user to an external host.
26
+ const pathname = window.location.pathname.replace(/^\/\/+/, '/');
27
+ return `${pathname}${window.location.search}`;
28
+ };
23
29
 
24
30
  /**
25
31
  * Options for the withAuthenticationRequired Higher Order Component