Hi! I'm trying to `GET /relation-tuples/check` fro...
# ory-network
t
Hi! I'm trying to
GET /relation-tuples/check
from my Java app using the SDK, but I get a 401 - Unauthorized. In the documentation, it seems that this endpoint doesn't require any authentication. What am I doing wrong?
Copy code
public Boolean canAccess() {
    ApiClient defaultClient = Configuration.getDefaultApiClient();

    defaultClient.setBasePath("<http://localhost:4000>");
    ReadApi api = new ReadApi(defaultClient);

    String object = "aGiftCard";
    String relation = "has";
    String subject = "3a2b0f2a-c988-4eb4-a337-f27f95a577d7";
    String namespace = "gift-cards";
    try {
      GetCheckResponse result = api.getCheck(namespace, object, relation, subject, null, null, null, null);
      return result.getAllowed();
    } catch (ApiException e) {
      log.error("Exception when calling ReadApi#getCheck");
      log.error("Status code: " + e.getCode());
      log.error("Reason: " + e.getResponseBody());
      log.error("Response headers: " + e.getResponseHeaders());
    }
    return false;
  }
Here's the error :
Copy code
Reason: {
  "error": {
    "code": 401,
    "status": "Unauthorized",
    "request": "399ba87b-013a-99a9-8ab0-8905af21e608",
    "message": "Access credentials are invalid"
  }
}
h
you probably need to set the bearer token to your personal access token
s
for Ory Cloud, the
read
API is protected by your personal access token