{"record":{"id":"62ea5defa6f7c78e","repo":"git-ecosystem/git-credential-manager","slug":"bitbucket-dc-oauth-client-secret-must-be-defined","errorCode":null,"errorMessage":"Bitbucket DC OAuth Client Secret must be defined","messagePattern":"Bitbucket DC OAuth Client Secret must be defined","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Atlassian.Bitbucket/DataCenter/BitbucketOAuth2Client.cs","lineNumber":66,"sourceCode":"            {\n                return redirectUri;\n            }\n\n            return DataCenterConstants.OAuth2RedirectUri;\n        }\n\n        private static string GetClientSecret(ISettings settings)\n        {\n            // Check for developer override value\n            if (settings.TryGetSetting(\n                DataCenterConstants.EnvironmentVariables.OAuthClientSecret,\n                Constants.GitConfiguration.Credential.SectionName, DataCenterConstants.GitConfiguration.Credential.OAuthClientSecret,\n                out string clientSecret))\n            {\n                return clientSecret;\n            }\n\n            throw new ArgumentException(\"Bitbucket DC OAuth Client Secret must be defined\");\n        }\n\n        private static OAuth2ServerEndpoints GetEndpoints(ISettings settings)\n        {\n            var remoteUri = settings.RemoteUri;\n            if (remoteUri == null)\n            {\n                throw new ArgumentException(\"RemoteUri must be defined to generate Bitbucket DC OAuth2 endpoint Urls\");\n            }\n\n            return new OAuth2ServerEndpoints(\n                new Uri(BitbucketHelper.GetBaseUri(remoteUri) + \"/rest/oauth2/latest/authorize\"),\n                new Uri(BitbucketHelper.GetBaseUri(remoteUri) + \"/rest/oauth2/latest/token\")\n                );\n        }\n    }\n}\n","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/git-ecosystem/git-credential-manager/blob/e8ce762cd04b4100ae637b5fbf39ef9d0a96561e/src/Atlassian.Bitbucket/DataCenter/BitbucketOAuth2Client.cs#L48-L84","documentation":"BitbucketOAuth2Client.GetClientSecret reads the OAuth client secret from the Git credential config (DataCenterConstants...OAuthClientSecret). When absent it throws ArgumentException because the OAuth2 token exchange cannot proceed without the secret paired to the client ID.","triggerScenarios":"Running the Bitbucket DC OAuth2 flow when `credential.bitbucketDCOAuthClientSecret` is not present in Git configuration, even if the client ID is set.","commonSituations":"Admin configured only the client ID and forgot the secret; secret stored under wrong config scope; users copying setup docs that cover only the ID field; CI containers with partial config injection.","solutions":["Set the secret: git config --global credential.bitbucketDCOAuthClientSecret <your-secret>","Confirm both bitbucketDCOAuthClientId and bitbucketDCOAuthClientSecret are set for the same host scope.","Re-run the DC setup instructions to provision the OAuth application secret from the Bitbucket admin console."],"exampleFix":"// before: only client id set, secret lookup fails\n$ git config --global credential.bitbucketDCOAuthClientId 0a1b2c3d\n// after: also set the secret\n$ git config --global credential.bitbucketDCOAuthClientId 0a1b2c3d\n$ git config --global credential.bitbucketDCOAuthClientSecret s3cr3t","handlingStrategy":"validation","validationCode":"$ git config --get credential.bitbucketDCOAuthClientSecret || echo \"client secret missing\"","typeGuard":null,"tryCatchPattern":"try { await oauth2Client.GetCredentialAsync(); } catch (ArgumentException ex) when (ex.Message.Contains(\"Client Secret\")) { /* prompt admin to configure the OAuth app secret */ }","preventionTips":["Always configure client ID and secret as a pair","Keep secrets in a protected config scope, not plaintext dotfiles shared across machines","Add a smoke-test command that verifies both keys exist"],"tags":["bitbucket","oauth2","configuration","git-credential-manager"],"backgroundTag":"missing-required-config-field","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"}