@@ -131,31 +131,23 @@ public override async Task<bool> DeleteCredentials(TargetUri targetUri)
131131 if ( targetUri is null )
132132 throw new ArgumentNullException ( nameof ( targetUri ) ) ;
133133
134- Credential credentials = await PersonalAccessTokenStore . ReadCredentials ( targetUri ) ;
134+ await PersonalAccessTokenStore . DeleteCredentials ( targetUri ) ;
135135
136- // Attempt to validate the credentials, if they're truly invalid delete them.
137- if ( ! await ValidateCredentials ( targetUri , credentials ) )
138- {
139- await PersonalAccessTokenStore . DeleteCredentials ( targetUri ) ;
140-
141- // Remove any related entries from the tenant cache because tenant change
142- // could the be source of the invalidation, and not purging the cache will
143- // trap the user in a limbo state of invalid credentials.
144-
145- // Deserialize the cache and remove any matching entry.
146- string tenantUrl = targetUri . ToString ( ) ;
147- var cache = await DeserializeTenantCache ( Context ) ;
136+ // Remove any related entries from the tenant cache because tenant change
137+ // could the be source of the invalidation, and not purging the cache will
138+ // trap the user in a limbo state of invalid credentials.
148139
149- // Attempt to remove the URL entry, if successful serialize the cache.
150- if ( cache . Remove ( tenantUrl ) )
151- {
152- await SerializeTenantCache ( Context , cache ) ;
153- }
140+ // Deserialize the cache and remove any matching entry.
141+ string tenantUrl = GetTargetUrl ( targetUri , keepUsername : false ) ;
142+ var cache = await DeserializeTenantCache ( Context ) ;
154143
155- return true ;
144+ // Attempt to remove the URL entry, if successful serialize the cache.
145+ if ( cache . Remove ( tenantUrl ) )
146+ {
147+ await SerializeTenantCache ( Context , cache ) ;
156148 }
157149
158- return false ;
150+ return true ;
159151 }
160152
161153 /// <summary>
0 commit comments