{"record":{"id":"c554da70ff65e2fc","repo":"theonedev/onedev","slug":"client-secret-needs-to-be-specified-to-generate-re","errorCode":null,"errorMessage":"Client secret needs to be specified to generate refresh token","messagePattern":"Client secret needs to be specified to generate refresh token","errorType":"exception","errorClass":"ExplicitException","httpStatus":null,"severity":"error","filePath":"server-plugin/server-plugin-mail-gmail/src/main/java/io/onedev/server/plugin/mail/gmail/GmailConnector.java","lineNumber":130,"sourceCode":"\t}\n\t\n\t@Editable(order=500, name=\"Check Incoming Email\", description=\"Enable this to process issue or pull request comments posted via email\")\n\tpublic InboxPollSetting getInboxPollSetting() {\n\t\treturn inboxPollSetting;\n\t}\n\n\tpublic void setInboxPollSetting(InboxPollSetting inboxPollSetting) {\n\t\tthis.inboxPollSetting = inboxPollSetting;\n\t}\n\n\t@SuppressWarnings(\"unused\")\n\tprivate static RefreshToken.Callback getRefreshTokenCallback() {\n\t\tString clientId = (String) EditContext.get().getInputValue(\"clientId\");\n\t\tif (clientId == null)\n\t\t\tthrow new ExplicitException(\"Client ID needs to be specified to generate refresh token\");\n\t\tString clientSecret = (String) EditContext.get().getInputValue(\"clientSecret\");\n\t\tif (clientSecret == null)\n\t\t\tthrow new ExplicitException(\"Client secret needs to be specified to generate refresh token\");\n\n\t\tString accountName = (String) EditContext.get().getInputValue(\"accountName\");\n\t\tif (accountName == null)\n\t\t\tthrow new ExplicitException(\"Account name needs to be specified to generate refresh token\");\n\n\t\tCollection<String> scopes = Lists.newArrayList(\"https://mail.google.com/\");\n\n\t\treturn new RefreshToken.Callback() {\n\n\t\t\t@Override\n\t\t\tpublic String getAuthorizeEndpoint() {\n\t\t\t\treturn AUTHORIZE_ENDPOINT;\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic Map<String, String> getAuthorizeParams() {\n\t\t\t\tMap<String, String> params = new HashMap<>();\n\t\t\t\tparams.put(\"access_type\", \"offline\");","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-plugin/server-plugin-mail-gmail/src/main/java/io/onedev/server/plugin/mail/gmail/GmailConnector.java#L112-L148","documentation":"Same refresh-token callback in GmailConnector: after validating clientId, it requires the clientSecret input. A null client secret makes the OAuth authorization-code flow impossible, so an ExplicitException is thrown.","triggerScenarios":"Generating a refresh token for the Gmail connector with a Client ID filled in but the 'Client Secret' input empty in the edit form.","commonSituations":"User entered only the client ID; Google Cloud secret was regenerated and old one cleared; user assumed the secret is only needed at connection time, not token generation.","solutions":["Enter the OAuth client secret (from Google Cloud Console credentials) in the form before generating the refresh token.","If the secret was lost, create a new one in Google Cloud Console and paste it in.","Verify the field is not blank-only (trailing whitespace) — re-enter the value."],"exampleFix":"// before\nclientSecret = null;\n// after\nclientSecret = \"GOCSPX-xxxxxxxxxxxxxxxx\";","handlingStrategy":"validation","validationCode":"if (!clientSecret || clientSecret.trim() === \"\") throw new Error(\"Fill Client Secret before generating refresh token\");","typeGuard":null,"tryCatchPattern":"try {\n    generateRefreshToken();\n} catch (ExplicitException e) {\n    alert(\"Complete the connector form first: \" + e.getMessage());\n}","preventionTips":["Keep the Google OAuth client secret handy when configuring the connector.","Regenerate the secret in Google Cloud Console if lost/expired.","Fill all OAuth fields before invoking the generate action."],"tags":["gmail","oauth","validation"],"backgroundTag":"missing-required-config-field","analyzedSha":"d44925c47c37992c828ea673a5f9620539bc3ff2","analyzedAt":"2026-09-06T07:18:27.995Z","contentChangedAt":"2026-09-06T07:18:27.995Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}