{"record":{"id":"44e9dfd73ebb54b0","repo":"theonedev/onedev","slug":"client-id-needs-to-be-specified-to-generate-refres","errorCode":null,"errorMessage":"Client ID needs to be specified to generate refresh token","messagePattern":"Client ID 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":127,"sourceCode":"\n\tpublic void setSystemAddress(String systemAddress) {\n\t\tthis.systemAddress = systemAddress;\n\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","sourceCodeStart":109,"sourceCodeEnd":145,"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#L109-L145","documentation":"GmailConnector's refresh-token generation callback reads the clientId field from the current connector edit form. If it is null, an ExplicitException is thrown because a Google OAuth client ID is mandatory to start the OAuth flow that produces a refresh token.","triggerScenarios":"Clicking the 'generate refresh token' action in the Gmail connector edit form while the 'Client ID' input is empty (EditContext input value is null).","commonSituations":"User tries to generate a refresh token before filling in OAuth credentials; form fields not yet saved; copy/paste of client secret but forgot client ID.","solutions":["Fill in the Google Cloud OAuth 2.0 Client ID in the connector form before generating the refresh token.","Create OAuth credentials in Google Cloud Console (Gmail API enabled) if none exist yet.","Save/re-render the form so EditContext picks up the clientId value."],"exampleFix":"// before: generate refresh token with clientId empty\nclientId = null;\n// after\nclientId = \"1234567890-abc.apps.googleusercontent.com\";","handlingStrategy":"validation","validationCode":"if (!clientId || clientId.trim() === \"\") throw new Error(\"Fill Client ID 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":["Create Google OAuth credentials before configuring the Gmail connector.","Fill clientId, clientSecret, and accountName together before clicking generate.","Check the form for empty required fields after pasting config from documentation."],"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"}