@@ -71,11 +71,13 @@ const getAuthConfiguration = (config: PassportConfiguration): UserManagerSetting
7171 token_endpoint : `${ authenticationDomain } /oauth/token` ,
7272 userinfo_endpoint : `${ authenticationDomain } /userinfo` ,
7373 end_session_endpoint : endSessionEndpoint . toString ( ) ,
74+ revocation_endpoint : `${ authenticationDomain } /oauth/revoke` ,
7475 } ,
7576 mergeClaims : true ,
7677 automaticSilentRenew : false , // Disabled until https://github.com/authts/oidc-client-ts/issues/430 has been resolved
7778 scope : oidcConfiguration . scope ,
7879 userStore,
80+ revokeTokenTypes : [ 'refresh_token' ] ,
7981 extraQueryParams : {
8082 ...config . extraQueryParams ,
8183 ...( oidcConfiguration . audience ? { audience : oidcConfiguration . audience } : { } ) ,
@@ -436,15 +438,22 @@ export default class AuthManager {
436438 }
437439
438440 public async logout ( ) : Promise < void > {
439- return withPassportError < void > (
440- async ( ) => {
441- if ( this . logoutMode === 'silent' ) {
442- return this . userManager . signoutSilent ( ) ;
443- }
444- return this . userManager . signoutRedirect ( ) ;
445- } ,
446- PassportErrorType . LOGOUT_ERROR ,
447- ) ;
441+ return withPassportError < void > ( async ( ) => {
442+ const user = await this . userManager . getUser ( ) ;
443+ if ( ! user ) {
444+ return ;
445+ }
446+
447+ if ( user . refresh_token ) {
448+ await this . userManager . revokeTokens ( [ 'refresh_token' ] ) ;
449+ }
450+
451+ if ( this . logoutMode === 'silent' ) {
452+ await this . userManager . signoutSilent ( ) ;
453+ } else {
454+ await this . userManager . signoutRedirect ( ) ;
455+ }
456+ } , PassportErrorType . LOGOUT_ERROR ) ;
448457 }
449458
450459 public async logoutSilentCallback ( url : string ) : Promise < void > {
0 commit comments