@@ -47,6 +47,7 @@ var AuthError_1 = require("../Errors/AuthError");
47
47
var RefreshTokenError_1 = require ( "../Errors/RefreshTokenError" ) ;
48
48
var UrlHelper_1 = require ( "../Helpers/UrlHelper" ) ;
49
49
var appauth_1 = require ( "@openid/appauth" ) ;
50
+ var CallbackError_1 = require ( "../Errors/CallbackError" ) ;
50
51
var HttpRequester = require ( '@openid/appauth/built/xhr' ) . FetchRequestor ;
51
52
var PKCECrypto = require ( '@openid/appauth/built/crypto_utils' ) . DefaultCrypto ;
52
53
var browser = typeof process === 'undefined' || ! process . release || process . release . name !== 'node' ;
@@ -89,6 +90,9 @@ var OAuth2Client = /** @class */ (function () {
89
90
return __generator ( this , function ( _e ) {
90
91
switch ( _e . label ) {
91
92
case 0 :
93
+ if ( payload . hasOwnProperty ( 'error' ) ) {
94
+ throw new CallbackError_1 . CallbackError ( payload . error_description , payload . error ) ;
95
+ }
92
96
state = payload . state ;
93
97
return [ 4 /*yield*/ , this . getState ( state ) ] ;
94
98
case 1 :
@@ -348,6 +352,7 @@ var OAuth2Client = /** @class */ (function () {
348
352
client_id : ( _b = this . config . clientId ) !== null && _b !== void 0 ? _b : '' ,
349
353
redirect_uri : ( _c = this . config . redirectUri ) !== null && _c !== void 0 ? _c : '' ,
350
354
scope : ( _e = ( _d = this . config . scopes ) === null || _d === void 0 ? void 0 : _d . join ( ' ' ) ) !== null && _e !== void 0 ? _e : '' ,
355
+ state : this . config . state ,
351
356
response_type : responseType ,
352
357
extras : extras ,
353
358
} , new PKCECrypto ( ) , this . config . pkceVerification ) ;
0 commit comments