theonedev/onedev · error · AuthenticationException

You are not member of discord server

Error message

You are not member of discord server

What it means

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.

Source

Thrown at server-plugin/server-plugin-sso-discord/src/main/java/io/onedev/server/plugin/sso/discord/DiscordConnector.java:131

			
			if (userInfoResponse.isOK()) {
				JSONObject userObject = userInfoResponse.getContentAsJSONObject();
				
				String subject = (String) userObject.get("id");
				String userName = (String) userObject.get("username");
				String email = StringUtils.trimToNull((String) userObject.get("email"));
				Boolean verified = (Boolean) userObject.get("verified");
				if (verified != null && !verified)
					email = null;
				
				if (bCheckGuilds) {
					UserGuildsResponse guildsResponse = apiRequest.getUserGuilds(accessTokenResponse);
					
					if (guildsResponse.isOK()) {
						JSONObject serverInfo = guildsResponse.getServerInfo(getServerId());
						
						if (serverInfo == null) {
							throw new AuthenticationException(_T("You are not member of discord server"));
						}
					} else {
						throw new AuthenticationException(_T("Unable to get guilds info"));
					}
				}

				return new SsoAuthenticated(subject, userName, email, null, null, null);
			} else {
				String errorMessage = userInfoResponse.getMessage();
				if (errorMessage != null) {
					throw new AuthenticationException(errorMessage);
				}
				
				throw new AuthenticationException(userInfoResponse.getContent());
			}
		} catch (IOException | JSONException e) {
			throw new RuntimeException(e);
		}

View on GitHub (pinned to d44925c47c)

Solutions

  1. Join the configured Discord server with the account used to log in, then retry SSO.
  2. Double-check the server ID configured in the Discord SSO connector matches the intended guild (copy via Discord 'Copy ID' with developer mode enabled).
  3. Temporarily disable 'Verify server membership' in the connector if membership should not be enforced.
  4. If the server has many guilds for the user, confirm the connector's getUserGuilds call handles pagination.

Example fix

// before: user not in guild configured
"serverId": "123456789012345678"  // wrong guild
// after
"serverId": "876543210987654321"  // the actual required Discord server ID
Defensive patterns

Strategy: validation

Validate before calling

// Before enabling membership verification, confirm user is in the guild via Discord API:
// GET /users/@me/guilds with a token having the guilds scope,
// and check the configured serverId appears in the list.

Try / catch

try {
    auth = connector.handleAuthResponse(...);
} catch (AuthenticationException e) {
    if (e.getMessage().contains("not member of discord server")) {
        // show guidance: join the required server, then retry
    }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06). Data as JSON: /api/errors/e6074e6343d3a6ea. Report an issue: GitHub.