@auth0/auth0-react 2.0.1 → 2.0.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.
@@ -150,12 +150,20 @@
150
150
  };
151
151
  var normalizeErrorFn = function (fallbackMessage) {
152
152
  return function (error) {
153
- if ('error' in error) {
154
- return new OAuthError(error.error, error.error_description);
155
- }
156
153
  if (error instanceof Error) {
157
154
  return error;
158
155
  }
156
+ // try to check errors of the following form: {error: string; error_description?: string}
157
+ if (error !== null &&
158
+ typeof error === 'object' &&
159
+ 'error' in error &&
160
+ typeof error.error === 'string') {
161
+ if ('error_description' in error &&
162
+ typeof error.error_description === 'string') {
163
+ return new OAuthError(error.error, error.error_description);
164
+ }
165
+ return new OAuthError(error.error);
166
+ }
159
167
  return new Error(fallbackMessage);
160
168
  };
161
169
  };
@@ -213,7 +221,7 @@
213
221
  deprecateRedirectUri(opts);
214
222
  return __assign(__assign({}, opts), { auth0Client: {
215
223
  name: 'auth0-react',
216
- version: '2.0.1',
224
+ version: '2.0.2',
217
225
  } });
218
226
  };
219
227
  /**