thousands-oyster-52810
08/18/2022, 11:09 AMGET /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?
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 :
Reason: {
"error": {
"code": 401,
"status": "Unauthorized",
"request": "399ba87b-013a-99a9-8ab0-8905af21e608",
"message": "Access credentials are invalid"
}
}
high-optician-2097
steep-lamp-91158
read
API is protected by your personal access token