{"record":{"id":"e6074e6343d3a6ea","repo":"theonedev/onedev","slug":"you-are-not-member-of-discord-server","errorCode":null,"errorMessage":"You are not member of discord server","messagePattern":"You are not member of discord server","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":131,"sourceCode":"\t\t\t\n\t\t\tif (userInfoResponse.isOK()) {\n\t\t\t\tJSONObject userObject = userInfoResponse.getContentAsJSONObject();\n\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}","sourceCodeStart":113,"sourceCodeEnd":149,"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#L113-L149","documentation":"Thrown by DiscordConnector.processTokenResponse when the 'Verify server membership' option is enabled: after fetching the user's guilds with the access token, the configured Discord server ID is not found among them. The connector therefore refuses to authenticate a user who is not a member of the required Discord server.","triggerScenarios":"SSO configured with a Discord server ID (server id field in the connector) and the authenticating user has not joined that server, or the guilds list returned by Discord (with the token's scope) does not include the configured guild.","commonSituations":"User left the required Discord server before logging in; Discord guilds list paginated beyond what getUserGuilds returns without paging; the server ID in connector settings is wrong, so it never matches any of the user's guilds; user joined the server after the OAuth token scope was issued.","solutions":["Join the configured Discord server with the account used to log in, then retry SSO.","Double-check the server ID configured in the Discord SSO connector matches the intended guild (copy via Discord 'Copy ID' with developer mode enabled).","Temporarily disable 'Verify server membership' in the connector if membership should not be enforced.","If the server has many guilds for the user, confirm the connector's getUserGuilds call handles pagination."],"exampleFix":"// before: user not in guild configured\n\"serverId\": \"123456789012345678\"  // wrong guild\n// after\n\"serverId\": \"876543210987654321\"  // the actual required Discord server ID","handlingStrategy":"validation","validationCode":"// Before enabling membership verification, confirm user is in the guild via Discord API:\n// GET /users/@me/guilds with a token having the guilds scope,\n// and check the configured serverId appears in the list.","typeGuard":null,"tryCatchPattern":"try {\n    auth = connector.handleAuthResponse(...);\n} catch (AuthenticationException e) {\n    if (e.getMessage().contains(\"not member of discord server\")) {\n        // show guidance: join the required server, then retry\n    }\n}","preventionTips":["Join the configured Discord server before logging in via SSO.","Copy the server ID with Discord developer mode to avoid typos.","Keep the 'guilds' scope in the connector so membership can be checked."],"tags":["oauth","sso","discord","guild-membership"],"backgroundTag":"oauth-access-denied","analyzedSha":"d44925c47c37992c828ea673a5f9620539bc3ff2","analyzedAt":"2026-09-06T07:18:27.995Z","contentChangedAt":"2026-09-06T07:18:27.995Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}