{"record":{"id":"0f943ed201cde1f1","repo":"theonedev/onedev","slug":"unable-to-get-guilds-info","errorCode":null,"errorMessage":"Unable to get guilds info","messagePattern":"Unable to get guilds info","errorType":"exception","errorClass":"AuthenticationException","httpStatus":null,"severity":"error","filePath":"server-plugin/server-plugin-sso-discord/src/main/java/io/onedev/server/plugin/sso/discord/DiscordConnector.java","lineNumber":134,"sourceCode":"\t\t\t\t\n\t\t\t\tString subject = (String) userObject.get(\"id\");\n\t\t\t\tString userName = (String) userObject.get(\"username\");\n\t\t\t\tString email = StringUtils.trimToNull((String) userObject.get(\"email\"));\n\t\t\t\tBoolean verified = (Boolean) userObject.get(\"verified\");\n\t\t\t\tif (verified != null && !verified)\n\t\t\t\t\temail = null;\n\t\t\t\t\n\t\t\t\tif (bCheckGuilds) {\n\t\t\t\t\tUserGuildsResponse guildsResponse = apiRequest.getUserGuilds(accessTokenResponse);\n\t\t\t\t\t\n\t\t\t\t\tif (guildsResponse.isOK()) {\n\t\t\t\t\t\tJSONObject serverInfo = guildsResponse.getServerInfo(getServerId());\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (serverInfo == null) {\n\t\t\t\t\t\t\tthrow new AuthenticationException(_T(\"You are not member of discord server\"));\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthrow new AuthenticationException(_T(\"Unable to get guilds info\"));\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn new SsoAuthenticated(subject, userName, email, null, null, null);\n\t\t\t} else {\n\t\t\t\tString errorMessage = userInfoResponse.getMessage();\n\t\t\t\tif (errorMessage != null) {\n\t\t\t\t\tthrow new AuthenticationException(errorMessage);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tthrow new AuthenticationException(userInfoResponse.getContent());\n\t\t\t}\n\t\t} catch (IOException | JSONException e) {\n\t\t\tthrow new RuntimeException(e);\n\t\t}\n\t}\n\t\n\tprivate String getScopes() {","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-plugin/server-plugin-sso-discord/src/main/java/io/onedev/server/plugin/sso/discord/DiscordConnector.java#L116-L152","documentation":"Thrown by DiscordConnector.processTokenResponse when the API request to list the user's Discord guilds (GET users/@me/guilds) does not return an OK response, so server membership cannot be verified. The connector cannot confirm the user belongs to the configured Discord server and aborts authentication.","triggerScenarios":"After exchanging the token, apiRequest.getUserGuilds(accessTokenResponse) receives a non-2xx response from Discord — commonly caused by the access token lacking the 'guilds' scope, an expired/invalid token, or Discord API downtime/rate limiting.","commonSituations":"Connector's OAuth scopes missing 'guilds' or 'guilds.read'; Discord API incident or rate limit (429) at login time; network/proxy blocking api.discord.com from the OneDev server; token already revoked by user.","solutions":["Add the 'guilds' (and/or 'guilds.read') scope to the Discord SSO connector's scope configuration.","Retry the login later or check Discord status page if Discord API is rate-limiting or down.","Verify the OneDev server can reach https://discord.com/api (check proxies/firewall).","Re-authenticate from scratch so a fresh, valid access token is used."],"exampleFix":"// before\nscopes: [\"identify\", \"email\"]\n// after\nscopes: [\"identify\", \"email\", \"guilds\"]","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    auth = connector.handleAuthResponse(...);\n} catch (AuthenticationException e) {\n    if (e.getMessage().contains(\"Unable to get guilds info\")) {\n        // check Discord API status/network, then retry login after a delay\n    }\n}","preventionTips":["Include the 'guilds' scope in the connector configuration.","Monitor Discord API status before mass SSO rollouts.","Ensure the OneDev server has outbound HTTPS access to discord.com.","Handle 429 rate limits with backoff in any custom automation."],"tags":["oauth","sso","discord","api","network"],"backgroundTag":"upstream-api-error","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"}