swepayError Catalog

Native Guard

Invalid Access Token 401

The Bearer token sent to the membership listing was rejected.

type https://errors.swepay.com.br/native-guard/memberships-invalid-token

What this means

Returned by GET /identity/v1/realms/{realm}/me/memberships when a Bearer token was sent but cannot be accepted for the realm in the path: it failed signature or structure validation, is expired, was revoked, or does not belong to that realm.

detail carries a short reason for diagnostics. Its wording is not part of the contract — do not branch on it.

Common causes

  • The access token is expired.
  • The token was revoked, for example after a logout.
  • The token was issued by a different realm than the one in the path, or that realm is not available.
  • The value is not an access token (an ID or refresh token), or it is malformed.

How to resolve

Obtain a new access token for that realm — refresh it, or sign the user in again — and retry. The request is retryable only with a new token; resending the same one keeps returning 401. Never log or echo the token value.

Example response

HTTP 401 · application/problem+json
{
  "type": "https://errors.swepay.com.br/native-guard/memberships-invalid-token",
  "title": "Invalid Access Token",
  "status": 401,
  "detail": "Token expired",
  "traceId": "Root=1-00000000-000000000000000000000000;Parent=0000000000000000;Sampled=0"
}

References

Machine-readable: /native-guard/memberships-invalid-token.json