@@ -47,6 +47,7 @@ var AuthError_1 = require("../Errors/AuthError");
4747var RefreshTokenError_1 = require ( "../Errors/RefreshTokenError" ) ;
4848var UrlHelper_1 = require ( "../Helpers/UrlHelper" ) ;
4949var appauth_1 = require ( "@openid/appauth" ) ;
50+ var CallbackError_1 = require ( "../Errors/CallbackError" ) ;
5051var HttpRequester = require ( '@openid/appauth/built/xhr' ) . FetchRequestor ;
5152var PKCECrypto = require ( '@openid/appauth/built/crypto_utils' ) . DefaultCrypto ;
5253var browser = typeof process === 'undefined' || ! process . release || process . release . name !== 'node' ;
@@ -89,6 +90,9 @@ var OAuth2Client = /** @class */ (function () {
8990 return __generator ( this , function ( _e ) {
9091 switch ( _e . label ) {
9192 case 0 :
93+ if ( payload . hasOwnProperty ( 'error' ) ) {
94+ throw new CallbackError_1 . CallbackError ( payload . error_description , payload . error ) ;
95+ }
9296 state = payload . state ;
9397 return [ 4 /*yield*/ , this . getState ( state ) ] ;
9498 case 1 :
@@ -348,6 +352,7 @@ var OAuth2Client = /** @class */ (function () {
348352 client_id : ( _b = this . config . clientId ) !== null && _b !== void 0 ? _b : '' ,
349353 redirect_uri : ( _c = this . config . redirectUri ) !== null && _c !== void 0 ? _c : '' ,
350354 scope : ( _e = ( _d = this . config . scopes ) === null || _d === void 0 ? void 0 : _d . join ( ' ' ) ) !== null && _e !== void 0 ? _e : '' ,
355+ state : this . config . state ,
351356 response_type : responseType ,
352357 extras : extras ,
353358 } , new PKCECrypto ( ) , this . config . pkceVerification ) ;
0 commit comments