https://www.ory.sh/ logo
#talk-keto
Title
# talk-keto
m

many-garden-6507

05/07/2022, 8:09 AM
Hi Community, I have converted this curl rest
relationtuple='
{
"namespace": "models",
"object": "nermodels",
"relation": "train",
"subject_id": "Aqib"
}'
curl --fail --silent -X PUT \
--data "$relationtuple" \
<http://127.0.0.1:4467/relation-tuples> > /dev/null \
&& echo "Successfully created tuple" \
|| echo "Encountered error"
request into axios one
const relationtuple =
{
"namespace": "models",
"object": "nermodels",
"relation": "train",
"subject_id": "Aqib"
}
axios({
method: "put",
url: '<http://127.0.0.1:4467/relation-tuples>',
// data: formData,
data:relationtuple
})
.then(response => {
console.log(response)
// console.log(typeof(response.data.ner))
})
for sending the request using react js but when i send the request i get cors error i am using this docker-compose https://github.com/gen1us2k/ory_workshop/tree/master/keto file for keto server (edited) I know it is because of different origins, how can i resolve it?
@User @User @User @User @User
s

steep-lamp-91158

05/07/2022, 8:47 AM
Keto is not secure to expose directly, if you do that a user is able of getting permissions of a different user
m

many-garden-6507

05/07/2022, 8:52 AM
ok than how can i access the rest end point using front end framework like React, or i cannot do this?
s

steep-lamp-91158

05/07/2022, 8:54 AM
You need a backend wrapper that ensures the queries are allowed I.e. take the subject from the session instead of allowing the client to specify it
m

many-garden-6507

05/07/2022, 8:55 AM
ok than how can i do this i mean which session, the one we get from ory kratos?
Any example or docs for that?
what if i use grpc client, do i need to do this like backend wrapper or subject from session, etc or i can diretly use grpc client with react?
@User
s

steep-lamp-91158

05/07/2022, 9:52 AM
Browsers can't use gRPC It depends on how you authenticate your users See this example of how to use oathkeeper and Kratos https://ory-community.slack.com/archives/C01340V8KSM/p1651824896257679?thread_ts=1651824896.257679&amp;cid=C01340V8KSM
👀 1
7 Views