justauth/JustAuth · error · AuthException
5013
5013
Error message
Invalid team id
What it means
AuthException with AuthResponseStatus.ILLEGAL_TEAM_ID (code 5013) from AuthAppleRequest.checkConfig: config.getTeamId() is empty. The team id is the JWT issuer claim when JustAuth builds the client secret (getToken() uses issuer(this.config.getTeamId())), and Apple validates it against the key's owning team.
Source
Thrown at src/main/java/me/zhyd/oauth/request/AuthAppleRequest.java:108
.token(authToken)
.source(source.toString())
.build();
}
@Override
protected void checkConfig(AuthConfig config) {
super.checkConfig(config);
if (StringUtils.isEmpty(config.getClientId())) {
throw new AuthException(AuthResponseStatus.ILLEGAL_CLIENT_ID, source);
}
if (StringUtils.isEmpty(config.getClientSecret())) {
throw new AuthException(AuthResponseStatus.ILLEGAL_CLIENT_SECRET, source);
}
if (StringUtils.isEmpty(config.getKid())) {
throw new AuthException(AuthResponseStatus.ILLEGAL_KID, source);
}
if (StringUtils.isEmpty(config.getTeamId())) {
throw new AuthException(AuthResponseStatus.ILLEGAL_TEAM_ID, source);
}
}
/**
* 获取token
* @see <a href="https://developer.apple.com/documentation/accountorganizationaldatasharing/creating-a-client-secret">creating-a-client-secret</a>
* @return jwt token
*/
private String getToken() {
return Jwts.builder().header().add(AbstractJwk.KID.getId(), this.config.getKid()).and()
.issuer(this.config.getTeamId())
.subject(this.config.getClientId())
.audience().add(AUD).and()
.expiration(new Date(System.currentTimeMillis() + TimeUnit.MINUTES.toMillis(3)))
.issuedAt(new Date())
.signWith(getPrivateKey())
.compact();
}View on GitHub (pinned to 694bbf1b01)
Solutions
- Set teamId to the 10-character Membership/Team ID from the Apple developer console (top-right of the console)
- After a team/organization change, refresh teamId, kid and the .p8 together and re-verify
- Add a startup assertion that all four Apple fields are present for the APPLE source
Example fix
// before
AuthConfig.builder().clientId("com.yourapp.auth").kid("ABC123DEFG").build();
// after
AuthConfig.builder()
.clientId("com.yourapp.auth")
.kid("ABC123DEFG")
.teamId("WXYZ1234AB")... Defensive patterns
Strategy: validation
Validate before calling
if (StringUtils.isEmpty(config.getTeamId()) || !config.getTeamId().matches("[A-Z0-9]{10}")) {
throw new IllegalStateException("APPLE teamId must be the 10-char Membership Team ID");
} Prevention
- Verify team id from the developer console membership page after any org transfer
- Keep teamId next to kid/.p8/Services ID in one config block
- Fail fast at boot rather than at first sign-in
When it happens
Trigger: Constructing AuthAppleRequest without teamId in AuthConfig. This is the last of the four Apple-specific config checks (clientId, clientSecret, kid, teamId).
Common situations: teamId omitted because other providers do not need it; membership in the Apple Developer Program transferred so the team id changed; multi-team orgs using the wrong 10-character team id.
Related errors
AI-assisted analysis of justauth/JustAuth@694bbf1b01 (2026-08-14).
Data as JSON: /api/errors/e47eda927a3a4a0f.
Report an issue: GitHub.