justauth/JustAuth · warning · AuthException
object.getString("message")
Error message
object.getString("message") What it means
AuthPinterestRequest.checkResponse intends to throw AuthException with the 'message' field when status equals FAILURE, but the guard '!object.containsKey("status") && FAILURE.equals(object.getString("status"))' is logically dead: it requires the status key to be ABSENT while simultaneously equal to 'failure', which can never both hold. In practice this exception is never thrown, so Pinterest errors surface later as NPEs/parse failures instead.
Source
Thrown at src/main/java/me/zhyd/oauth/request/AuthPinterestRequest.java:114
* @param authToken token
* @return 返回获取userInfo的url
*/
@Override
protected String userInfoUrl(AuthToken authToken) {
return UrlBuilder.fromBaseUrl(source.userInfo())
.queryParam("access_token", authToken.getAccessToken())
.queryParam("fields", "id,username,first_name,last_name,bio,image")
.build();
}
/**
* 检查响应内容是否正确
*
* @param object 请求响应内容
*/
private void checkResponse(JSONObject object) {
if (!object.containsKey("status") && FAILURE.equals(object.getString("status"))) {
throw new AuthException(object.getString("message"));
}
}
}
View on GitHub (pinned to 694bbf1b01)
Solutions
- Upgrade JustAuth to a version where the condition is fixed to object.containsKey("status") && "failure".equals(object.getString("status")) or equivalent
- If pinned to this version, wrap Pinterest calls in try-catch for both AuthException and NullPointerException and inspect the raw response
- Verify Pinterest app credentials and scopes independently of this (non-firing) check
- Migrate to Pinterest API v5 endpoints if you control the source config
Example fix
// before (dead condition — never throws)
if (!object.containsKey("status") && FAILURE.equals(object.getString("status"))) {
throw new AuthException(object.getString("message"));
}
// after (correct guard)
if (FAILURE.equals(object.getString("status"))) {
throw new AuthException(object.getString("message"));
} Defensive patterns
Strategy: try-catch
Validate before calling
null
Type guard
null
Try / catch
try {
return pinterestRequest.getUserInfo(token);
} catch (AuthException | NullPointerException e) {
// this JustAuth version's checkResponse is dead code; errors surface as NPEs
log.warn("Pinterest user info failed: {}", e.getMessage(), e);
throw new AuthenticationServiceException("Pinterest login failed", e);
} Prevention
- Upgrade JustAuth to a release fixing the inverted containsKey condition
- Wrap Pinterest calls for both AuthException and NPE while on affected versions
- Verify Pinterest API v5 credentials/scopes separately since v1 endpoints are retired
When it happens
Trigger: Any Pinterest API error response (failed token exchange, invalid token) — the intended trigger — but the broken condition means the throw is unreachable; the error leaks out downstream as missing-field NPEs (e.g. getString on a null node).
Common situations: Developers debug why Pinterest failures produce NullPointerException in getUserInfo rather than a clean AuthException; Pinterest API v5 also changed response shapes vs the v1 this code targeted.
Related errors
- object.getString("error_description") / object.getString("er
- object.getString("msg")
- 5002
- data.getString("description")
- object.getString("error")
AI-assisted analysis of justauth/JustAuth@694bbf1b01 (2026-08-14).
Data as JSON: /api/errors/a0b01554bd06ac85.
Report an issue: GitHub.