@auth0/auth0-react 1.10.2 → 1.11.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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "author": "Auth0",
3
3
  "name": "@auth0/auth0-react",
4
- "version": "1.10.2",
4
+ "version": "1.11.0",
5
5
  "description": "Auth0 SDK for React Single Page Applications (SPA)",
6
6
  "keywords": [
7
7
  "auth0",
@@ -39,8 +39,7 @@
39
39
  "test:nextjs:watch": "start-server-and-test start:api 3001 start:nextjs 3000 cypress:open",
40
40
  "test:integration": "npm run test:cra && npm run test:gatsby && npm run test:nextjs",
41
41
  "cypress:run": "cypress run --spec 'cypress/integration/smoke.test.ts'",
42
- "cypress:open": "cypress open",
43
- "codecov": "codecov"
42
+ "cypress:open": "cypress open"
44
43
  },
45
44
  "repository": {
46
45
  "type": "git",
@@ -63,7 +62,6 @@
63
62
  "@typescript-eslint/eslint-plugin": "^5.17.0",
64
63
  "@typescript-eslint/parser": "^5.17.0",
65
64
  "browserstack-cypress-cli": "^1.1.2",
66
- "codecov": "^3.8.2",
67
65
  "cypress": "^9.5.3",
68
66
  "eslint": "^8.12.0",
69
67
  "eslint-plugin-react": "^7.29.4",
@@ -74,8 +72,8 @@
74
72
  "oidc-provider": "^7.10.6",
75
73
  "prettier": "2.6.2",
76
74
  "pretty-quick": "^3.1.3",
77
- "react": "^18.1.0",
78
- "react-dom": "^18.1.0",
75
+ "react": "^18.2.0",
76
+ "react-dom": "^18.2.0",
79
77
  "react-test-renderer": "^18.0.0",
80
78
  "rollup": "^2.70.1",
81
79
  "rollup-plugin-analyzer": "^4.0.0",
@@ -102,6 +100,6 @@
102
100
  }
103
101
  },
104
102
  "dependencies": {
105
- "@auth0/auth0-spa-js": "^1.22.0"
103
+ "@auth0/auth0-spa-js": "^1.22.2"
106
104
  }
107
105
  }
@@ -19,6 +19,7 @@ import {
19
19
  RedirectLoginResult,
20
20
  ICache,
21
21
  GetTokenSilentlyOptions,
22
+ User,
22
23
  } from '@auth0/auth0-spa-js';
23
24
  import Auth0Context, { RedirectLoginOptions } from './auth0-context';
24
25
  import { hasAuthParams, loginError, tokenError } from './utils';
@@ -46,7 +47,7 @@ export interface Auth0ProviderOptions {
46
47
  * It uses `window.history` but you might want to overwrite this if you are using a custom router, like `react-router-dom`
47
48
  * See the EXAMPLES.md for more info.
48
49
  */
49
- onRedirectCallback?: (appState?: AppState) => void;
50
+ onRedirectCallback?: (appState?: AppState, user?: User) => void;
50
51
  /**
51
52
  * By default, if the page url has code/state params, the SDK will treat them as Auth0's and attempt to exchange the
52
53
  * code for a token. In some cases the code might be for something else (another OAuth SDK perhaps). In these
@@ -250,13 +251,15 @@ const Auth0Provider = (opts: Auth0ProviderOptions): JSX.Element => {
250
251
  didInitialise.current = true;
251
252
  (async (): Promise<void> => {
252
253
  try {
254
+ let user: User | undefined;
253
255
  if (hasAuthParams() && !skipRedirectCallback) {
254
256
  const { appState } = await client.handleRedirectCallback();
255
- onRedirectCallback(appState);
257
+ user = await client.getUser();
258
+ onRedirectCallback(appState, user);
256
259
  } else {
257
260
  await client.checkSession();
261
+ user = await client.getUser();
258
262
  }
259
- const user = await client.getUser();
260
263
  dispatch({ type: 'INITIALISED', user });
261
264
  } catch (error) {
262
265
  dispatch({ type: 'ERROR', error: loginError(error) });