@@ -967,12 +967,12 @@ export class AuthClient {
967967
968968 if ( ! session ) {
969969 if ( this . noContentProfileResponseWhenUnauthenticated ) {
970- auth0Res . status ( null , 204 ) ;
971- } else {
972- auth0Res . status ( null , 401 ) ;
970+ return auth0Res . status ( null , 204 ) ;
973971 }
974- return auth0Res ;
972+
973+ return auth0Res . status ( null , 401 ) ;
975974 }
975+
976976 auth0Res . json ( session ?. user ) ;
977977 auth0Res . addCacheControlHeadersForSession ( ) ;
978978 return auth0Res ;
@@ -987,7 +987,7 @@ export class AuthClient {
987987 const scope = auth0Req . getUrl ( ) . searchParams . get ( "scope" ) ;
988988
989989 if ( ! session ) {
990- auth0Res . json (
990+ return auth0Res . json (
991991 {
992992 error : {
993993 message : "The user does not have an active session." ,
@@ -998,7 +998,6 @@ export class AuthClient {
998998 status : 401
999999 }
10001000 ) ;
1001- return auth0Res ;
10021001 }
10031002
10041003 const [ error , getTokenSetResponse ] = await this . getTokenSet ( session , {
@@ -1007,7 +1006,7 @@ export class AuthClient {
10071006 } ) ;
10081007
10091008 if ( error ) {
1010- auth0Res . json (
1009+ return auth0Res . json (
10111010 {
10121011 error : {
10131012 message : error . message ,
@@ -1018,7 +1017,6 @@ export class AuthClient {
10181017 status : 401
10191018 }
10201019 ) ;
1021- return auth0Res ;
10221020 }
10231021
10241022 const { tokenSet : updatedTokenSet } = getTokenSetResponse ;
@@ -1047,37 +1045,32 @@ export class AuthClient {
10471045 auth0Res : Auth0Response
10481046 ) : Promise < Auth0Response > {
10491047 if ( ! this . sessionStore . store ) {
1050- auth0Res . status ( "A session data store is not configured." , 500 ) ;
1051- return auth0Res ;
1048+ return auth0Res . status ( "A session data store is not configured." , 500 ) ;
10521049 }
10531050
10541051 if ( ! this . sessionStore . store . deleteByLogoutToken ) {
1055- auth0Res . status (
1052+ return auth0Res . status (
10561053 "Back-channel logout is not supported by the session data store." ,
10571054 500
10581055 ) ;
1059- return auth0Res ;
10601056 }
10611057
10621058 const body = new URLSearchParams ( await auth0Req . getBody ( ) ) ;
10631059 const logoutToken = body . get ( "logout_token" ) ;
10641060
10651061 if ( ! logoutToken ) {
1066- auth0Res . status ( "Missing `logout_token` in the request body." , 400 ) ;
1067- return auth0Res ;
1062+ return auth0Res . status ( "Missing `logout_token` in the request body." , 400 ) ;
10681063 }
10691064
10701065 const [ error , logoutTokenClaims ] =
10711066 await this . verifyLogoutToken ( logoutToken ) ;
10721067 if ( error ) {
1073- auth0Res . status ( error . message , 400 ) ;
1074- return auth0Res ;
1068+ return auth0Res . status ( error . message , 400 ) ;
10751069 }
10761070
10771071 await this . sessionStore . store . deleteByLogoutToken ( logoutTokenClaims ) ;
10781072
1079- auth0Res . status ( null , 204 ) ;
1080- return auth0Res ;
1073+ return auth0Res . status ( null , 204 ) ;
10811074 }
10821075
10831076 async handleConnectAccount (
@@ -1099,13 +1092,11 @@ export class AuthClient {
10991092 ) ;
11001093
11011094 if ( ! connection ) {
1102- auth0Res . status ( "A connection is required." , 400 ) ;
1103- return auth0Res ;
1095+ return auth0Res . status ( "A connection is required." , 400 ) ;
11041096 }
11051097
11061098 if ( ! session ) {
1107- auth0Res . status ( "The user does not have an active session." , 401 ) ;
1108- return auth0Res ;
1099+ return auth0Res . status ( "The user does not have an active session." , 401 ) ;
11091100 }
11101101
11111102 const [ getTokenSetError , getTokenSetResponse ] = await this . getTokenSet (
@@ -1117,11 +1108,10 @@ export class AuthClient {
11171108 ) ;
11181109
11191110 if ( getTokenSetError ) {
1120- auth0Res . status (
1111+ return auth0Res . status (
11211112 "Failed to retrieve a connected account access token." ,
11221113 401
11231114 ) ;
1124- return auth0Res ;
11251115 }
11261116
11271117 const { tokenSet } = getTokenSetResponse ;
@@ -1139,11 +1129,10 @@ export class AuthClient {
11391129 await this . connectAccount ( { tokenSet, ...connectAccountParams } ) ;
11401130
11411131 if ( connectAccountError ) {
1142- auth0Res . status (
1132+ return auth0Res . status (
11431133 connectAccountError . message ,
11441134 connectAccountError . cause ?. status ?? 500
11451135 ) ;
1146- return auth0Res ;
11471136 }
11481137
11491138 // update the session with the new token set, if necessary
0 commit comments