File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
src/shared/Microsoft.Git.CredentialManager/Authentication Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -236,13 +236,23 @@ private async Task RegisterTokenCacheAsync(IPublicClientApplication app)
236
236
}
237
237
catch ( MsalCachePersistenceException ex )
238
238
{
239
- Context . Streams . Error . WriteLine ( "warning: cannot persist Microsoft Authentication data securely!" ) ;
239
+ Context . Streams . Error . WriteLine ( "warning: cannot persist Microsoft authentication token cache securely!" ) ;
240
240
Context . Trace . WriteLine ( "Cannot persist Microsoft Authentication data securely!" ) ;
241
241
Context . Trace . WriteException ( ex ) ;
242
242
243
- // On Linux the SecretService/keyring might not be available so we must fall-back to a plaintext file.
244
- if ( PlatformUtils . IsLinux ( ) )
243
+ if ( PlatformUtils . IsMacOS ( ) )
245
244
{
245
+ // On macOS sometimes the Keychain returns the "errSecAuthFailed" error - we don't know why
246
+ // but it appears to be something to do with not being able to access the keychain.
247
+ // Locking and unlocking (or restarting) often fixes this.
248
+ Context . Streams . Error . WriteLine (
249
+ "warning: there is a problem accessing the login Keychain - either manually lock and unlock the " +
250
+ "login Keychain, or restart the computer to remedy this" ) ;
251
+ }
252
+ else if ( PlatformUtils . IsLinux ( ) )
253
+ {
254
+ // On Linux the SecretService/keyring might not be available so we must fall-back to a plaintext file.
255
+ Context . Streams . Error . WriteLine ( "warning: using plain-text fallback token cache" ) ;
246
256
Context . Trace . WriteLine ( "Using fall-back plaintext token cache on Linux." ) ;
247
257
var storageProps = CreateTokenCacheProps ( clientId , useLinuxFallback : true ) ;
248
258
helper = await MsalCacheHelper . CreateAsync ( storageProps ) ;
You can’t perform that action at this time.
0 commit comments