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