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