File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -89,7 +89,16 @@ public override async Task<ICredential> GenerateCredentialAsync(InputArguments i
89
89
switch ( promptResult . AuthenticationMode )
90
90
{
91
91
case AuthenticationModes . Basic :
92
- return await GeneratePersonalAccessTokenAsync ( targetUri , promptResult . BasicCredential ) ;
92
+ ICredential patCredential = await GeneratePersonalAccessTokenAsync ( targetUri , promptResult . BasicCredential ) ;
93
+ // HACK: Store the PAT immediately in case this PAT is not valid for SSO.
94
+ // We don't know if this PAT is valid for SAML SSO and if it's not Git will fail
95
+ // with a 403 and call neither 'store' or 'erase'. The user is expected to fiddle with
96
+ // the PAT permissions manually on the web and then retry the Git operation.
97
+ // We must store the PAT now so they can resume/repeat the operation with the same,
98
+ // now SSO authorized, PAT.
99
+ // See: https://github.com/microsoft/Git-Credential-Manager-Core/issues/133
100
+ Context . CredentialStore . AddOrUpdate ( GetCredentialKey ( input ) , patCredential ) ;
101
+ return patCredential ;
93
102
94
103
case AuthenticationModes . OAuth :
95
104
return await GenerateOAuthCredentialAsync ( targetUri ) ;
You can’t perform that action at this time.
0 commit comments