justauth/JustAuth · warning · AuthException

5003

5003

Error message

Unsupported operation

What it means

AuthSource.revoke() is a default interface method that throws AuthException 5003 (Unsupported operation). Any provider enum that does not override revoke() (most of them) will throw this the moment a revoke flow needs the revocation endpoint URL. It signals that the provider integration does not support token revocation, not that your code is wrong.

Solutions

  1. Check whether your provider's AuthDefaultSource entry overrides revoke(); if not, skip the revoke call for that provider.
  2. If the provider has a real revocation endpoint, extend the source: create a custom AuthSource that overrides revoke() and pass it via extendSource, or override revoke() in your AuthDefaultRequest subclass.
  3. Treat revoke as best-effort: catch AuthException with code 5003 and continue local logout.

Example fix

// before
request.revoke(token); // 5003 for providers without revoke()

// after
try { request.revoke(token); }
catch (AuthException e) {
    if (e.getErrcode() != AuthResponseStatus.UNSUPPORTED.getCode()) throw e;
    // provider has no revoke endpoint; local logout only
}
Defensive patterns

Strategy: type-guard

Type guard

boolean canRevoke(AuthSource source) {
    // true only when the concrete enum overrides revoke(); detect via a probe
    try { source.revoke(); return true; }
    catch (AuthException e) { return e.getErrcode() == AuthResponseStatus.UNSUPPORTED.getCode() ? false : true; }
}

Try / catch

try { request.revoke(token); } catch (AuthException e) { if (e.getErrcode() != AuthResponseStatus.UNSUPPORTED.getCode()) throw e; /* no revoke endpoint: local logout only */ }

Prevention

When it happens

Trigger: Calling request.revoke(token) on a provider whose AuthDefaultSource entry does not override revoke() — e.g. DINGTALK, TAOBAO, CSDN and most others; a generic logout flow that revokes tokens for every provider.

Common situations: Implementing 'log out everywhere' across multiple providers where only some support revocation (e.g. Google/GitHub do, many Chinese providers do not); upgrading flows that previously ignored revoke.

Related errors


AI-assisted analysis of justauth/JustAuth@694bbf1b01 (2026-08-14). Data as JSON: /api/errors/00e1a39de83a4354. Report an issue: GitHub.

Appendix: source

Thrown at src/main/java/me/zhyd/oauth/config/AuthSource.java:54

     *
     * @return url
     */
    String accessToken();

    /**
     * 获取用户信息的api
     *
     * @return url
     */
    String userInfo();

    /**
     * 取消授权的api
     *
     * @return url
     */
    default String revoke() {
        throw new AuthException(AuthResponseStatus.UNSUPPORTED);
    }

    /**
     * 刷新授权的api
     *
     * @return url
     */
    default String refresh() {
        throw new AuthException(AuthResponseStatus.UNSUPPORTED);
    }

    /**
     * 获取Source的字符串名字
     *
     * @return name
     */
    default String getName() {
        if (this instanceof Enum) {

View on GitHub (pinned to 694bbf1b01)