{"record":{"id":"cad2d38923478029","repo":"git-ecosystem/git-credential-manager","slug":"interactive-logon-for-0-failed","errorCode":null,"errorMessage":"Interactive logon for '{0}' failed.","messagePattern":"Interactive logon for '(.+?)' failed\\.","errorType":"exception","errorClass":"Trace2Exception","httpStatus":null,"severity":"error","filePath":"src/GitHub/GitHubHostProvider.cs","lineNumber":399,"sourceCode":"                if (result.Type == GitHubAuthenticationResultType.Success)\n                {\n                    _context.Trace.WriteLine($\"Token acquisition for '{targetUri}' succeeded.\");\n\n                    token = result.Token;\n                }\n            }\n\n            if (token != null)\n            {\n                // Resolve the GitHub user handle\n                GitHubUserInfo userInfo = await _gitHubApi.GetUserInfoAsync(targetUri, token);\n\n                return new GitCredential(userInfo.Login, token);\n            }\n\n            var format = \"Interactive logon for '{0}' failed.\";\n            var message = string.Format(format, targetUri);\n            throw new Trace2Exception(_context.Trace2, message, format);\n        }\n\n        internal async Task<AuthenticationModes> GetSupportedAuthenticationModesAsync(Uri targetUri)\n        {\n            // Check for an explicit override for supported authentication modes\n            if (_context.Settings.TryGetSetting(\n                GitHubConstants.EnvironmentVariables.AuthenticationModes,\n                Constants.GitConfiguration.Credential.SectionName, GitHubConstants.GitConfiguration.Credential.AuthenticationModes,\n                out string authModesStr))\n            {\n                if (Enum.TryParse(authModesStr, true, out AuthenticationModes authModes) && authModes != AuthenticationModes.None)\n                {\n                    _context.Trace.WriteLine($\"Supported authentication modes override present: {authModes}\");\n                    return authModes;\n                }\n                else\n                {\n                    _context.Trace.WriteLine($\"Invalid value for supported authentication modes override setting: '{authModesStr}'\");","sourceCodeStart":381,"sourceCodeEnd":417,"githubUrl":"https://github.com/git-ecosystem/git-credential-manager/blob/e8ce762cd04b4100ae637b5fbf39ef9d0a96561e/src/GitHub/GitHubHostProvider.cs#L381-L417","documentation":"After GCM performs an interactive (browser/GUI) GitHub logon to obtain a Personal Access Token, if the token is null or the interactive flow did not produce a usable credential, GeneratePersonalAccessTokenAsync throws this Trace2Exception formatted with the target URI. It signals that the interactive authentication attempt completed without yielding a token.","triggerScenarios":"Calling GitHubHostProvider.GenerateCredentialAsync which routes to GeneratePersonalAccessTokenAsync; the interactive logon (via GitHubAuthentication) returns no token (user completed the dialog path but token was null/empty) for the given targetUri.","commonSituations":"GitHub login dialogs that report success but fail to mint a PAT (OAuth app restrictions, SAML SSO not authorized, org policies); network failure right after authentication; enterprise/GHE instances rejecting the token request.","solutions":["Retry the interactive logon and ensure any requested OAuth authorization (SSO/org access) is completed in the browser.","Fall back to a PAT: create one at github.com/settings/tokens and store it via 'git-credential-manager github login --pat' or 'git credential approve'.","Check organization/SAML policy: authorize GCM's OAuth app for the organization or enable SSO for your token.","Inspect trace logs (GCM_TRACE=1) to see why the token was null after logon."],"exampleFix":"// before (interactive logon returned no token)\ngit-credential-manager github login\n\n// after (use an explicit PAT)\ngit-credential-manager github login --pat\n// paste a PAT created at https://github.com/settings/tokens","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try\n{\n    var cred = await provider.GenerateCredentialAsync(targetUri, modes);\n}\ncatch (Exception ex) when (ex.Message.Contains(\"Interactive logon for\") && ex.Message.Contains(\"failed\"))\n{\n    // prompt for an explicit PAT and retry with it\n}","preventionTips":["Ensure the OAuth app/organization authorizations (SAML SSO) are granted before logging in","Keep a valid PAT as fallback for interactive logon failures","Check GCM_TRACE=1 logs after any failed interactive logon","Complete the browser authentication fully before closing the window"],"tags":["github","authentication","pat","interactive-logon"],"backgroundTag":"authentication-required","analyzedSha":"e8ce762cd04b4100ae637b5fbf39ef9d0a96561e","analyzedAt":"2026-09-11T17:15:08.753Z","contentChangedAt":"2026-09-11T17:15:08.753Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}